Read Excel file in android - android

Im developing an android App I want to read the data in from Excel File Anyone having Idea How to read Excel file in android. I keep my file in res/raw folder and try to read it as given in this tutorial http://www.vogella.de/articles/JavaExcel/article.html Its not working if anyone having Idea then Reply Please
Thank you
Abhishek

Try using Apache POI
Also, see this related question

You could try out jexcelapi (http://jexcelapi.sourceforge.net/) or apache poi (http://poi.apache.org/).

Keep the file in the SDcard and give the path of the SDCArd while reading the file
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File(sdCard.getAbsolutePath() + "/Excel/filename.xls");
For eg. if you are keeping the file in excel folder then give the path as above

Related

Downloading Files - Location

This is a real newbie question.
I am going to be creating an app that downloads an XML file, which contains links to mp3 files.
Where should I download these files too?
I mean can I bundle the XML file under /res and then download the latest XML file over the top of it? Currently I have some mp3 files in /res/raw.
Would I be able to do the same?
I think you should save your XML file in your own directory in SD Card and just read that file content using XmlPullParser in your application.
File file = new File(Environment.getExternalStorageDirectory() + "/your_dir/your_xml.xml");
How to create Folder/Directory in SD card ?
How to read XML data from SD Card ?
I hope this is enough as per your requirement.

Keeping a text file in android

I am new to android and facing issue with file system usages.
I have seen several threads but i am still not able to find the answer which i am looking for my requirement.
I have a original file say test.xml which i want to keep somewhere in my eclipse project so that as soon as i install the app it should move my test.xml file into data directory so that i would be able to read it
please refere this link :
http://developer.android.com/training/basics/data-storage/files.html
I want to save my original file at : "/data/data/com.example.helloWorld/files"
I should be able to get the file handle form the below command
File file = new File(context.getFilesDir(), filename);
Please Note i dont want to save my file in asset folder.
Thanks,
Manish Bansal
I recommend you use assets as storage for your file initially as that will get compiled with your app, then once the user starts your app you check if your file exists and if not you can save the asset to the internal storage location as specified in the documentation, from there you can use the file as you like in the filesystem.

Get filename of file from web directory

I'm trying to simply get the filename of a file from an online directory. The directory only has one file in it. The filename is actually the version number. If the filename is "newer" than the file that I already have stored on the android, it will download the file and replace it. I already know how to download the file. I'm not sure if android has some sort of built-in directory lister or if I need to create a PHP file that will display the files, then somehow open and read that in and use that as my path. Any help would be greatly appreciated.
You'll want to write that PHP script to return the file name. With that, you can do a straight download from the server.

How to open csv file in Android

I am new to Android. I've created a .csv file in SD card. Now I want to open this file but unable to do this.
Please help me on how to open a .csv file.
You can open a .csv file like you would any text file. In order to read it, look for some examples in java - like Parse CSV File using StringTokenizer example
http://code.google.com/p/secrets-for-android/source/browse/trunk/src/au/com/bytecode/opencsv/CSVReader.java?r=19
This could parse a csv file
I posted some example code here: How to parse the CSV file in android application?
You would obviously have to change it slightly to access a file on the sdcard and not in the assets folder.

How to open a text file of some xyz format which is placed in the sd card in the android device

How to open a text file of some xyz format which is placed in the sd card in the android device, if anybody knows please help me.
File sdPath = Environment.getExternalStorageDirectory();
File textFile = new File(sdPath, "textfile.xyz")
from there use the common Java IO streams.
Check also the examples coming with the Android SDK.

Categories

Resources