How i convert a excel file to csv file

S

Santana

Hei friends,
i'am new in newbie in Perl, and i try i convert a excel file in csv
file in Suse 10.0 linux.

I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux
but when i try run this script :

use strict;
use Spreadsheet::parseExcel;


my $excel = Spreadsheet::parseExcel::Workbook->Parse($file);
foreach my $sheet (@{$excel->{Worksheet}}) {
printf("Sheet: %s\n", $sheet->{Name});
$sheet->{MaxRow} ||= $sheet->{MinRow};
foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
$sheet->{MaxCol} ||= $sheet->{MinCol};
foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
my $cell = $sheet->{Cells}[$row][$col];
if ($cell) {
printf("( %s , %s ) => %s\n", $row, $col, $cell-
}
}
}
}



I have a error something like this :

"Can´t locate Spreadsheet.pm in @INC(@INC constains : ............"



Can you help me, please ??

Thanks,
Paulito
 
S

Serman D.

I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux [..]
"Can´t locate Spreadsheet.pm in @INC(@INC constains : ............"

This message means you did not properly install the module, or at
least, Perl was unable to find it. I install CPAN modules as follows:

$ perl -wle 'use strict; use Spreadsheet::parseExcel'
Can't locate Spreadsheet/ParseExcel.pm in @INC (@INC contains: ...)

$ sudo su -
# perl -MCPAN -e shell

cpan[1]> i Spreadsheet::parseExcel
Strange distribution name [Spreadsheet::parseExcel]
Module id = Spreadsheet::parseExcel
DESCRIPTION Get information from Excel file
CPAN_USERID SZABGAB (Gabor Szabo <[email protected]>)
CPAN_VERSION 0.32
CPAN_FILE S/SZ/SZABGAB/Spreadsheet-ParseExcel-0.32.tar.gz
DSLIP_STATUS RdpOp (released,developer,perl,object-
oriented,Standard-Perl)
INST_FILE (not installed)

cpan[3]> install Spreadsheet::parseExcel
Running install for module 'Spreadsheet::parseExcel'
Running make for S/SZ/SZABGAB/Spreadsheet-ParseExcel-0.32.tar.gz
[...]

cpan[4]> quit
# exit

$ perl -wle 'use strict; use Spreadsheet::parseExcel'
$

Observe that we now did get no output - which means the module was
properly installed.
 
X

xhoster

Santana said:
Hei friends,
i'am new in newbie in Perl, and i try i convert a excel file in csv
file in Suse 10.0 linux.

I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux
but when i try run this script :

use strict;
use Spreadsheet::parseExcel;

my $excel =3D Spreadsheet::parseExcel::Workbook->Parse($file);

$file has not been declared.

foreach my $sheet (@{$excel->{Worksheet}}) {
printf("Sheet: %s\n", $sheet->{Name});
$sheet->{MaxRow} ||=3D $sheet->{MinRow};
foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
$sheet->{MaxCol} ||=3D $sheet->{MinCol};
foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
my $cell =3D $sheet->{Cells}[$row][$col];
if ($cell) {
printf("( %s , %s ) =3D> %s\n", $row, $col, $cell-
}
}
}
}

I have a error something like this :

"Can=B4t locate Spreadsheet.pm in @INC(@INC constains : ............"

Can you help me, please ??

If you want actual help, you should post actual code and actual error, not
"something like" them.

Perhaps you a have an unnecessary line "use Spreadsheet;" somewhere in your
code that you are not showing us. If so, take it out.

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top