I needed a batch converter to turn non-xml style Excel spreadsheets (all the older versions) into delimited text files. If you run it without supplying a sheet name, it will list all the sheets available. You can also optionally define a delimiter to use instead of the default comma. So here’s my code along with part of the xlrd module which I tweaked a little.
#!/usr/bin/perl -w
# For each tab (worksheet) in a file (workbook),
# spit out columns separated by “,”,
# and rows separated by c/r.
use Spreadsheet::ParseExcel;
use strict;
my $filename = shift || “Book1.xls”;
my $e = new Spreadsheet::ParseExcel;
my $eBook = $e->Parse($filename);
my $sheets = $eBook->{SheetCount};
my ($eSheet, $sheetName);
foreach my $sheet (0 .. $sheets - 1) {
…