Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to read an XLS File (Microsoft Excel) using unix Bash / Corn shell script?

share|improve this question
    
What information do you want from it? Can you work with the OOXML .xlsx format instead, which makes life easier. –  Charles Stewart Mar 2 '11 at 9:09
    
No. Actualy I am trying to fetch data from a XLS file and trying to do some manupulation on that. –  chanchal1987 Mar 2 '11 at 10:19
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
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 Mar 2 '11 at 12:56
add comment

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.

share|improve this answer
add comment

Use a CSV file which opens with excel and a flat file in Linux / Solaris

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.