Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

What is the best module for parsing Excel documents

by lupey (Monk)
on Oct 21, 2007 at 23:07 UTC ( #646329=perlquestion: print w/ replies, xml ) Need Help??
lupey has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I'm about to start a small consulting job with a company that needs ~400 excel documents parsed. Rather than spend my time opening each document and manually saving it as "text", I've heard of Excel modules such as Spreadsheet-ParseExcel but I know little about how well they work. I'd like a module that is popular with the Perl community and one that is actively being maintained. If it makes a difference, I do most of my Perl scripting on Cygwin. Any suggestions?

Thank you

Comment on What is the best module for parsing Excel documents
Download Code
Replies are listed 'Best First'.
Re: What is the best module for parsing Excel documents
by erroneousBollock (Curate) on Oct 22, 2007 at 00:13 UTC
    Spreadsheet::ParseExcel does what you want, but if you simply want to avoid manually opening excel to do the CSV exports, use Win32::OLE to automate the process.

    -David

Re: What is the best module for parsing Excel documents
by Gangabass (Vicar) on Oct 22, 2007 at 02:09 UTC
Re: What is the best module for parsing Excel documents
by roboticus (Chancellor) on Oct 22, 2007 at 02:15 UTC
    I've used Spreadsheet::ParseExcel, and really like it. However, I tend to stick to the plain vanilla features, so I don't know if it's suitable for what you want. If you're just wanting to read a bunch of data out of spreadsheets, it's probably the right choice.

    ...roboticus

Re: What is the best module for parsing Excel documents
by strat (Canon) on Oct 22, 2007 at 08:50 UTC

    If you have Win32::OLE installed (I don't know if this is possible under Cygwin), you could have a look at ExcelPerl, e.g. convert the file to csv with something like:

    perl excelPerl.pl -begin "use Text::CSV_XS; $csv = Text::CSV_XS->new( +{ binary => 1 } )" -ane "$csv->combine(@F); print $csv->string, $/" - +f test.xls > outfile.csv

    Or if you want to keep the formulas:

    perl excelPerl.pl -begin "use Text::CSV_XS; $csv = Text::CSV_XS->new( +{ binary => 1 } )" -ane "$csv->combine( map { $_->{FormulaLocal} } @C +); print $csv->string, $/" -f test.xls > outfile.csv

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://646329]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-09-05 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (151 votes), past polls