Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Reading XLS file using Perl

by rammohan (Acolyte)
on Feb 12, 2014 at 10:41 UTC ( [id://1074605]=perlquestion: print w/replies, xml ) Need Help??

rammohan has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Reading XLS file using Perl
by marto (Cardinal) on Feb 12, 2014 at 10:52 UTC
Re: Reading XLS file using Perl
by hdb (Monsignor) on Feb 12, 2014 at 10:56 UTC

    You need to study the documentation. There are examples how to use the module properly. For example:

    my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('Book1.xls');

    and not

    my $workbook = Spreadsheet::ParseExcel->new($filename);
Re: Reading XLS file using Perl
by marto (Cardinal) on Feb 12, 2014 at 11:51 UTC

    "Sorry update: I want to copy a .xls to another .xls file i tried"

    If you simply want to create a copy of file you don't need to read and parse it.

    #!/usr/bin/perl use strict; use warnings; use File::Copy; copy("source.xls","target.xls") or die "Copy failed: $!"

    File::Copy.

      Speaking of exceptions Path::Tiny also uses File::Copy :)
      $ perl -le " use Path::Tiny qw/ path /; path( 1 )->copy( 666 ) " copy failed for 1 to 666: No such file or directory at -e line 1.

        This is news to me, looks useful. Thanks.

Re: Reading XLS file using Perl
by hawtin (Prior) on Feb 12, 2014 at 11:01 UTC

    I don't use Spreadsheet::ParseExcel any more, so I can't answer your question. I can however tell you where you are going wrong (like it says line 9 the call to Spreadsheet/ParseExcel->new()), what is going wrong (the function is expecting to be passed arguments in pairs) and how to check (look at line 167 inthe file /usr/local/share/perl5/Spreadsheet/ParseExcel.pm)

    The documentation (that I can see) says that you call the Spreadsheet::ParseExcel module like this

    my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('Book1.xls');

    As others have mentioned you have some later mistakes as well, the 'worksheet' object returned by ParseExcel probably doesn't match the one needed by WriteExcel. So you have to unpick one and build up the other.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Reading XLS file using Perl
by marto (Cardinal) on Feb 12, 2014 at 11:39 UTC

    "What is the next step ???"

    If you don't know what you want to do next, how are we supposed to be able to tell you? You haven't explained what you are trying to achieve. Why have you ignored the links I've given you? Have you considered not writing code? You don't seem very interested in learning how to do it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1074605]
Approved by shmem
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-23 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found