I am new to android development. I have two questions:
I have an Excel sheet as a database for my data. I want to display that data in my android application. How can I do it? Do I have to use SQLite database? If yes, then how?
If there are any changes in the Excel sheet in the future, then how would be these changes be reflected in the application?
Thanks in advance for all the help.
To read excel file in android, you should use some excel library such as JExcelApi, Apache POI.
after reading it, you can write them into SQLite dababase to reduce excel parsing time.
when you parse excel file, you save the file's last modified time to text file or preferences and whenever your app runs, comare them and update it if last modified time is different.
WelCome to Stack overflow!
I have an excel sheet as a database for my data.I want to display that data in my android
application.How can i do it? do i have to use sqlite database?if yes then how?
Here is example how read .xls file from server (you can also read file from SDCARD)
assume your .xls is like below
then you have to create sqlite database and create table with field(Item Number,Description,Price,Quantitiy) you can also create fields depend on .xls file.
after read data from .xls insert in to sqlite database
Note: with xls some times its not working well if file format is not well. i have developed app which work with xls,csv. so, i ll sagest you to use csv insted of xls which is best option. how read csv file and how write csv file.
And if there are any changes in the excel sheet in the future then how would be these changes be reflected in the application
any changes in xls then you have to update you sqlite database.(its easy if you have developed code to create table dynamically depend on xls file column then its good)
How to use sqlite in android Basic
How to use sqlite in android.
Related
I'm trying to use an excel file as a database and the app constantly needs to read and modify the file. As explained in this Q&A, it is necessary to create a copy of original excel file and all the modification has to be done there. Is there anyway to modify the excel file without creating a copy because I'll be using the file name at another instance to read it.
Also, I'd like your opinion on which one would be efficient as a database for offline access? An android sqlite or excel file ?
I'm fairly new to Android, I'm created simple CRUD operation app... now i want to save my data base into SD card in pdf or excel format.. can we do this .. if yes.. then how to achieve it or not.. then why?
Of course no ?
why use PDF or Excel !!!
You will not able to CRUD any more on this file ? even if we suppose you use a 3rd lib to update this file on android , but why use a file , it will be hard and even very slow compared to sqlite..
and how to deal with relation between record in your database ?
I advise you to use sqlite or any ORM in android instead of file like PDF or Excel... and you can export from database later a PDF/EXCEL/etc ...
I have a CSV file and am trying to convert it into an SQLite .db file so that I can use it in my Android app.
I am aware of methods I can use within the app to convert a CSV placed in the assets folder to an SQLite database within the Android app (e.g. by reading all lines from the CSV file and adding them to the SQLite database), however I want to generate a .db file outside of the app.
The reason I would prefer to do this is because I have several CSVs at around 5 MB each (over 350,000 rows) and so it would take too long to read them all and put them into a new SQLite database in the Android app.
I'm hoping that being able to put my .db files into the assets folder and using the android-sqlite-asset-helper library to access the data from these will be faster.
I have tried tools like a CSV to SQL converter which uses the data from the CSV file you upload to generate an SQL script (i.e. DROP then CREATE then INSERT), but I'm not sure what I need to do with the .sql file to make a .db out of it.
There are also some ways of doing this (I think) I found on Stack Overflow with commands, but I am unsure of how these work and how I use the commands.
So I am asking how I can convert a CSV file into an SQLite database. What is the best method?
Out of curiosity, have you tried creating the database from within the SQLite CLI? Facilities for CSV import exist: https://www.sqlite.org/cli.html#section_8 followed up with a quick ".save output.db" may accomplish what you need.
I have multiple long excel files on my computer that I need to use in my android application.
The excel files contains 10 000 rows and I was wondering how I could include it in the project so I can use it in the application on the phone. I know I should use some sort of database so I can use SQLite in the android application. How can that be done? Any links to tutorials?
thank you
You can use the Java Excel library for this. First you need to parse the excel file and then store that data in your mobile database.
You can use the following URL for further clarification.
http://www.vogella.com/tutorials/JavaExcel/article.html
I'm writing my first serious Android App, which basically is interface to three DB tables.
Data in those tables are predefined by me, so, user should install those app with those data.
What is the best way to include those data in application package? Maybe there is a way to embed SQLite into my application distribution?
Or is the only way is to define array of "insert into" strings somewhere in class and execute them to fill internal SQLite storage?
Would appreciate any recommendations.
I am currently doing the same thing in my app. Having a sqlite database file in my assets folder and copying it into the SD card at startup if it's not in there. There's a nice tutorial there and I use part of its code.
Put the database file in your assets and then copy it over to your application's data directory.
Your can check out this tutorial