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;
18 next unless m/\.xls$/i;
25 my ($vol, $path, $file) = File::Spec->splitpath(shift);
26 my $eBook = Spreadsheet::ParseExcel::Simple->read(File::Spec->catpath($vol,$path,$file));
27 unless (defined $eBook) {
28 warn "Can't open Spreadsheet in file $file (@".File::Spec->catpath($vol,$path,$file)."\n";
32 my @sheet = $eBook->sheets;
34 next unless $sheet[$_]->has_data();
37 $sfn .= '_' . $sheet[$_]->sheet->get_name() . '.tsv';
39 open TAB, '>', $sfn or do {
40 warn "Unable to write to $sfn";
44 while ($sheet[$_]->has_data) {
45 my @row = $sheet[$_]->next_row;
46 print TAB join("\t",@row)."\n";