Reading excel file in Unix through ODBC driver

  • achithu
  • Born
  • Born
  • No Avatar
  • Joined: Sep 30, 2006
  • Posts: 2
  • Status: Offline

Post September 30th, 2006, 6:35 am

Hi,

I have a program in Java running in Windows for reading Excel file.I have created a DSN for the excel file in ODBC datasources and read the contents of the file like reading from a database table using JDBC. I want to port this code in Unix environment. Is there any Odbc driver for Excel in Unix? Any inputs on how to port this into UNix environment is gretaly appreciated.Please reply me back if anyone has a solution and it is very urgent.

THanks a lot for help
Chithra
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 30th, 2006, 6:35 am

  • this213
  • Guru
  • Guru
  • User avatar
  • Joined: Mar 01, 2004
  • Posts: 1242
  • Loc: ./
  • Status: Offline

Post September 30th, 2006, 7:25 am

What kind of database?

Generally speaking, you need to export the excel file as a csv file, you can then either load that file directly by logging into your database server and running something like:
Code: [ Select ]
load data local infile 'mydata.csv' into table my_table
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(field1,field2,field3)
  1. load data local infile 'mydata.csv' into table my_table
  2. fields terminated by ','
  3. enclosed by '"'
  4. lines terminated by '\n'
  5. (field1,field2,field3)

Or you can parse the file through some script and load it however you need to.

Note, the query above is generalized and will probably be different for whatever database engine you're using (MySQL, Postgres, Oracle).
http://www.disabo.com
  • achithu
  • Born
  • Born
  • No Avatar
  • Joined: Sep 30, 2006
  • Posts: 2
  • Status: Offline

Post October 1st, 2006, 12:00 am

Hi,

Thanks for the suggestion. But I have a constraint of maintaining the excel file in.xls format itself and not convert to csv format.That's the reason I am looking for replicating the same scenario as in Windows(Like creating dsn with odbc and then trying to read).Loading the same into database is not a problem.Is it possible to read the data from excel file itself in Unix without coverting it into csv format?

Thanks in advance
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2673
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post October 2nd, 2006, 5:04 am

http://www.excelparser.com/index.php
This one reads xls files under Linux for 80 bucks.

While this one appears to do it for free, though requires some hand-holding. YMMV.
http://cran.r-project.org/src/contrib/D ... gmisc.html
"It's always a long day, 86,400 won't fit into a short."

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 80 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.