Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Download excel from website and save it to disk

by kalyanrajsista (Scribe)
on Jun 01, 2010 at 08:28 UTC ( #842535=perlquestion: print w/replies, xml ) Need Help??
kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks

I'm trying to download an excel file from a website using WWW::Mechanize module, but downloaded file is of binary format. How can I get the actual content of Excel file and save it to the disk.

use strict; use WWW::Mechanize; my $browser = WWW::Mechanize->new(); my $xlurl = " +%2014DAYS%20%20%2001%20%20JUNE%20%20%202010.xls"; my $xls = $browser->get($xlurl); my $xlcontent=$xls->as_string();

Replies are listed 'Best First'.
Re: Download excel from website and save it to disk
by Gangabass (Vicar) on Jun 01, 2010 at 08:48 UTC
Re: Download excel from website and save it to disk
by Corion (Pope) on Jun 01, 2010 at 08:56 UTC
      my $xlcontent

      above variable contain excel data in Binary format which is not actually stored anywhere in my disk, so I can't use any of the Module to read the excel data.

      I'm looking for saving the excel file on the disk and process it afterward.

        Yes. For saving, read up about binmode and print. For processing the data, read up about the modules I already linked to. You will need to do some reading and then some programming.

        Also, your assignment to $xlcontent does propably not do what you want. You want maybe

        my $xlcontent = $browser->content;

        Read WWW::Mechanize in addition to the other module documentation.

Re: Download excel from website and save it to disk
by sierpinski (Chaplain) on Jun 01, 2010 at 12:13 UTC
    Do you have wget available? It's purpose is to retrieve files via http/https.

    You could call it with the usual backticks, exec, or system calls. Detailed documentation for it can be found here.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://842535]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2018-01-24 06:18 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.