+++ /dev/null
-#! /usr/bin/perl
-# conver_to_xls converts tab separated files to xls and is released
-# under the terms of the GPL version 2, or any later version, at your
-# option. See the file README and COPYING for more information.
-# Copyright 2008 by Don Armstrong <don@donarmstrong.com>.
-# $Id: perl_script 1153 2008-04-08 00:04:20Z don $
-
-
-use warnings;
-use strict;
-
-use Getopt::Long;
-use Pod::Usage;
-
-=head1 NAME
-
-convert_to_xls - convert tab separated files to xls
-
-=head1 SYNOPSIS
-
-convert_to_xls tsv_file1 [tsv_file2] [options] > foo.xls
-
- Options:
- --debug, -d debugging level (Default 0)
- --help, -h display this help
- --man, -m display manual
-
-=head1 OPTIONS
-
-=over
-
-=item B<--debug, -d>
-
-Debug verbosity. (Default 0)
-
-=item B<--help, -h>
-
-Display brief useage information.
-
-=item B<--man, -m>
-
-Display this manual.
-
-=back
-
-=head1 EXAMPLES
-
-
-=cut
-
-use Spreadsheet::WriteExcel;
-use IO::File;
-
-use vars qw($DEBUG);
-
-my %options = (debug => 0,
- help => 0,
- man => 0,
- );
-
-GetOptions(\%options,
- 'debug|d+','help|h|?','man|m');
-
-pod2usage() if $options{help};
-pod2usage({verbose=>2}) if $options{man};
-
-$DEBUG = $options{debug};
-
-my @USAGE_ERRORS;
-if (not @ARGV) {
- push @USAGE_ERRORS,"You must give at least one file";
-}
-
-pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
-
-my @FILES=@ARGV;
-@ARGV=();
-
-my $wb = Spreadsheet::WriteExcel->new(\*STDOUT) or die "Unable to create new spreadsheet";
-for my $file (@FILES) {
- my $fh = IO::File->new($file,'r') or die "Unable to open $file for reading: $!";
- my $ws = $wb->add_worksheet($file) or die "Unable to create new worksheet";
- my $row = 1;
- while (<$fh>) {
- chomp;
- my @row = map {s/^"//; s/"$//; $_} split /\t/,$_;
- for my $col (0..$#row) {
- $ws->write($row,$col+1,$row[$col]);
- }
- $row++;
- }
-}
-$wb->close;
-
-
-__END__