I want to retrieve an excel spreadsheet (eventually several at
different locations) and display the contents in a web page.
if i copy the file locally ive got everything working as expected.I
cant retrieve the file and do the same though.
if i do this with a local file it works
#!/usr/bin/perl -w
use strict;
use warnings;
use Spreadsheet::ParseExcel;
use DateTime::Format::Excel;
use Data::Dumper;
use Date::Manip;
use Statistics::Descriptive::Discrete ;
use Storable;
use LWP::Simple;
use CGI;
my $q = new CGI;
print $q->header;
print $q->start_html();#
$file='/tmp/data.xls';
die "Couldn't get excel file " unless defined $file;
my $cell;my $row;my $sheet;my $col;my $excel;
$excel = Spreadsheet::ParseExcel::Workbook->Parse($file) or die ("cant
open file");
etc etc
if i do this it doesnt display
#!/usr/bin/perl -w
use strict;
use warnings;
use Spreadsheet::ParseExcel;
use DateTime::Format::Excel;
use Data::Dumper;
use Date::Manip;
#use Date::Calc;# qw(Week_of_Year);
use Statistics::Descriptive::Discrete ;
use Storable;
use LWP::Simple;
use CGI;
my $q = new CGI;
print $q->header;
print $q->start_html();#
my $url = "http://intranet/.<blah>.xls";
my $file =get $url;
die "Couldn't get excel file " unless defined $file;
my $cell;my $row;my $sheet;my $col;my $excel;
$excel = Spreadsheet::ParseExcel::Workbook->Parse($file) or die ("cant
open file");
the original file when copied is
-rwxrwxrwx 1 paul paul 58880 2009-12-15 08:47 data.xls
if i get it and save it , it is different
my $url = "http://blah .xls";
my $file = get $url;
open (F, '>/tmp/data.xls');
print F $file;
close (F);
-rw-r--r-- 1 paul paul 59392 2009-12-21 18:18 data.xls
is there a way to automatically retrieve the excel file as i wish ( so
that changes to the excel spreadshet are automatically updated in the
web page .
Excel will open the the downloaded file as well as from the intranet
and they look identical in excel
doing a diff just says the binary files are different.
what am i doing wrong ?
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/