How to convert an Excel file to text file using Perl.

How to convert an Excel file to text file using Perl.
use Spreadsheet::ParseExcel;
my $file = shift || die "Give me an Excel file!\n";
-e $file and -r _ or die "Must provide valid Excel file! $file, $!\n";
my $excel_obj = Spreadsheet::ParseExcel->new(); my $workbook = $excel_obj->Parse($file);
die "Workbook did not return worksheets!\n" unless ref $workbook->{Worksheet} eq 'ARRAY';
for my $worksheet ( @{$workbook->{Worksheet}} ) { for my $row ( 0 .. $worksheet->{MaxRow} ) { for my $col ( 0 .. $worksheet->{MaxCol} ) { my $cell = $worksheet->{Cells}[$row][$col]; print ref $cell ? $cell->Value : ''; print "\t" unless $col == $worksheet->{MaxCol}; } print "\n"; # record ends } print "\n"; # worksheet ends }
[close] Permanent link · http://querylog.com/q/How+to+convert+an+Excel+file+to+text+file+using+Perl.

Suggested HTML for linking:
Link preview: How to convert an Excel file to text file using Perl.
25 February 2004 · Internet & computing
The page found by the original query:
Converting Excel to delimited text
Browse by the page—15 Q&R each
« previous | more »