How to read an XLS File (Microsoft Excel) using unix Bash / Korn shell (ksh) script?
-
What information do you want from it? Can you work with the OOXML .xlsx format instead, which makes life easier.Charles Stewart– Charles Stewart2011-03-02 09:09:32 +00:00Commented Mar 2, 2011 at 9:09
-
No. Actualy I am trying to fetch data from a XLS file and trying to do some manupulation on that.chanchal1987– chanchal19872011-03-02 10:19:28 +00:00Commented Mar 2, 2011 at 10:19
4 Answers
With straight-up shell script you're more than likely sunk, but there are at least three Perl modules that can be used to parse excel spreadsheets and extract data from them.
Fair warning, none of them are particularly pretty, although Spreadsheet::ParseExcel::Simple is probably your best bet for a quick solution.
It's in debian 5.0 (Lenny) as libspreadsheet-parseexcel-simple-perl; Other distributions may have their own naming schemes.
Depending on what you want to do with it a quick perl script should do the trick.
-
Same opinion. With straight-up shell script probably you'll not succed. Just to give you another option other than Perl, take a look at Apache POI (projects.apache.org/projects/poi.html). It's a JAVA lib that handles MS Office files.Bob Rivers– Bob Rivers2011-03-02 12:56:58 +00:00Commented Mar 2, 2011 at 12:56
It is hard to work with closed format like the old Office formats, convert it into a xml based format using Office/OpenOffice/LibreOffice.
Then use xsltproc (or some other xml parser) to get the data in a way that you can work with.
There exists a linux package called csvkit available in debian and on github: https://github.com/wireservice/csvkit which includes a command to convert xls to csv...