3 #~ Converter Script for XLS to TSV. Handles Multiple Tabs into separate files.
4 #~ (c)2004 Anima Legato <l3gatosan@gmail.com>
6 #~ This code is redistributable and modifiable under the same terms as Perl
12 use Spreadsheet::ParseExcel::Simple;
17 next unless m/\.xls$/i;
24 my ($vol, $path, $file) = File::Spec->splitpath(shift);
25 my $eBook = Spreadsheet::ParseExcel::Simple->read(File::Spec->catpath($vol,$path,$file));
26 unless (defined $eBook) {
27 warn "Can't open Spreadsheet in file $file (@".File::Spec->catpath($vol,$path,$file)."\n";
31 my @sheet = $eBook->sheets;
33 next unless $sheet[$_]->has_data();
36 $sfn.= ((@sheet > 1) ? sprintf(".%02i",$_) : "").'.tab';
37 open TAB, '>', $sfn or do {
38 warn "Unable to write to $sfn";
42 while ($sheet[$_]->has_data) {
43 my @row = $sheet[$_]->next_row;
44 print TAB join("\t",@row)."\n";