2

I have an excel sheet on which I need to hit a few queries. I have successfully accessed the excel sheet in my project but now I have trouble hitting queries on it because I need to write code fetch even a small column. Is there any way that I can convert my excel sheet into the SQLite database? As it will simplify my work. The Excel sheet is too big with 29 sheets in it. It is impossible to manually enter those values.

Younes
  • 462
  • 7
  • 15
neha
  • 267
  • 2
  • 6
  • 15
  • http://stackoverflow.com/questions/7357355/how-to-read-excel-sheets-in-android-program/7357391#7357391 – Nikunj Patel Sep 14 '11 at 06:49
  • I have already used this lib. But my problem is i don want to read excel sheet. I want to convert it into database, Its easy to hit queries for sqlite than writing code for each fetch to excel sheet. – neha Sep 14 '11 at 06:53

2 Answers2

11

You have a few practical options:

  1. You can open the Excel file directly in the app, as IanNorton said

  2. You can convert the Excel to a SQLite file first, and then drop and read that SQLite file in the app.

If you want to convert Excel to SQLite and query the SQLite DB in your app , use option #2. But if you just want to read an Excel file straight in your app, use option #1.

Code Slinger
  • 1,100
  • 1
  • 11
  • 16
4

SQLite is a relational database format, excel is a spreadsheet. There is no direct relationship between the two for there to be a generic conversion tool.

You do not mention if you need the formulae or formatting. But you could use the code mentioned here, How to read excel sheets in android program.

Then it is up to you how you structure your sqlite database and save the values you've read.

Community
  • 1
  • 1
IanNorton
  • 7,145
  • 2
  • 25
  • 28