3 # xls2csv: Convert Microsoft Excel spreadsheet to CSV
4 # (m)'08 [10-03-2008] Copyright H.M.Brand 2008-2013
11 my $err = shift and select STDERR;
12 print "usage: $0 [ -o file.csv ] file.xls\n";
13 @_ and print join "\n", @_, "";
17 use Getopt::Long qw( :config bundling nopermute passthrough );
21 "help|?" => sub { usage 1; },
26 my $xls = shift or usage 1, "No input file";
27 -r $xls or usage 1, "Input file unreadable";
28 -s $xls or usage 1, "Input file empty";
30 $csv or ($csv = $xls) =~ s/\.xls$/.csv/i;
32 $opt_f or die "$csv already exists\n";
36 print STDERR "Converting $xls to $csv ...\n";
37 open STDOUT, ">", $csv;
38 exec "xlscat", "-c", $xls;