Question posted 2011 · +7 upvotes
I’m working on an Android app in which I have to open & close excel files on button click. These excel files will be readonly. After closing the excel file, it should direct me to the app.
Please suggest me a way to do this.
Accepted answer +13 upvotes
here is a manual route.
How to read excel file using JXL 2.6.12 jar
but here is a little more easier one.
but i guess you have to find out the MIME TYPE.
EDIT
got the mime type as well
Setting mime type for excel document
UPDATE
so something like this might work.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/vnd.ms-excel");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(OpenPdf.this, "No Application Available to View Excel", Toast.LENGTH_SHORT).show();
}
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
.