For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2004 > Re: excel









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: excel
Jeff Westman

2004-05-21, 2:31 pm

I just did this in fact using CSV.pm, worked great! See:

http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm




--- "DiGregorio, Dave" <ddigregorio@vocollect.com> wrote:
> Does anyone know, what is the best way to retrieve text data from
> an Excel
> Spreadsheet? I have tried the code below and it returns errors.
> I can not
> even get the name of the file to print!
>
>
>
>
>
>
>
> #! usr/bin/perl -w
>
>
>
> use strict ;
>
> use Spreadsheet::ParseExcel ;
>
> my $oExcel = new Spreadsheet::ParseExcel::Workbook ;
>
>
>
> my $oBook = $oExcel->Parse('Excel/Test.xls') ;
>
>
>
> print "File :" , $oBook->{File} , "\n" ;
>
> print "Count :" , $oBook->{SheetCount} , "\n" ;
>
> print "Author :" , $oBook->{Author} , "\n" ;
>
> I
>
>
>
> Thanks
>
>
>
> David
>
>






__________________________________
Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
Kevin Old

2004-05-22, 1:33 pm

I use the xls2csv utility that comes with Spreadsheet::ParseExcel.

Here's how I use it:

#!/usr/bin/perl

use warnings;
use strict;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::Utility qw(xls2csv);

my $content = xls2csv('myspreadsheet.xls', 'A5:Q164');

# $content is now the spreadsheet in csv format

my @lines = split/\n/, $content;


HTH,
Kevin

On Fri, 2004-05-21 at 13:35, Jeff Westman wrote:
> I just did this in fact using CSV.pm, worked great! See:
>
> http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm
>
>
>
>
> --- "DiGregorio, Dave" <ddigregorio@vocollect.com> wrote:
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer

--
Kevin Old <kold@kold.homelinux.com>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com