androidmads / SQLite2XL

Library to Convert SQLite to Excel and Vice-Versa
MIT License
166 stars 58 forks source link

Cannot open exported file in excel. #7

Closed Habush closed 6 years ago

Habush commented 6 years ago

I am using this library to export a SQLite database to an excel readable file. I use Room Persistance Library as an abstraction over SQLite database to write to the database, but I think that shouldn't matter (I may be wrong). I am using the following code to export the database:

         sqLiteToExcel = new SQLiteToExcel(getActivity().getApplicationContext(), "testdb.db", path);
         sqLiteToExcel.exportAllTables("test.xls", new SQLiteToExcel.ExportListener() {
            @Override
            public void onStart() {

            }

            @Override
            public void onCompleted(String filePath) {
                Toast.makeText(getActivity(), "Successfully exported database", Toast.LENGTH_LONG).show();
            }

            @Override
            public void onError(Exception e) {
                Toast.makeText(getActivity(), "Error in exporting database: " + e.getMessage(), Toast.LENGTH_LONG).show();       Log.d(TAG, e.getStackTrace()[0].toString());
            }
        });

However, when I try to open the file using MS Excel, it gives me The file cannot be opened because it is corrupt error. What is wrong here? How can I solve this?

Thanks in advance

Habush commented 6 years ago

Ooops..turns out the issue was that I included .db extension in the name of the database paramter to the SQLiteToExcel constructor. Hence, removing the extension and just using the db name resolved the issue. Anyways, thanks for developing this library!

androidmads commented 6 years ago

Thanks Bro for Contribution

ArunkumarAndanshetti commented 6 years ago

Sir how to update database through the importing excel sheet

mughalgpkn commented 2 months ago

Hi dear jcenter is closed and now your library is not working kindly help