469,315 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

Convert Excel to CSV

Hi,

How to convert a excel file to .csv format?

Please provide me the Perl Module and the script to do this funcionality.


Thank you!
Jan 8 '07 #1
6 15763
miller
1,089 Expert 1GB
You simply need two CPAN modules to accomplish this:

http://search.cpan.org/search?query=...et::ParseExcel
http://search.cpan.org/search?query=Text::CSV
Jan 9 '07 #2
Hi,

I have installed Spreadsheet::ParseExcel in my Unix Machine. When i am trying to call this Module using the below mentioned script, It is giving me a error saying that" Module cannot be found"

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use Spreadsheet::ParseExcel;
  3.  
  4. my $excel = Spreadsheet::ParseExcel::Workbook->Parse(Excel File1.xls);
  5. foreach my $sheet (@{$excel->{Worksheet}}) {
  6.     printf("Sheet: %s\n", $sheet->{Name});
  7.     $sheet->{MaxRow} ||= $sheet->{MinRow};
  8.     foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
  9.         $sheet->{MaxCol} ||= $sheet->{MinCol};
  10.         foreach my $col ($sheet->{MinCol} ..  $sheet->{MaxCol}) {
  11.             my $cell = $sheet->{Cells}[$row][$col];
  12.             if ($cell) {
  13.                 printf("( %s , %s ) => %s\n", $row, $col, $cell->{Val});
  14.             }
  15.         }
  16.     }
  17. }
Could you please assist me on this and give me the correct code?

Thanks,

Aravind
Jan 15 '07 #3
Perler
1
Are you sure that you included something like

#!/usr/bin/perl

at the top of your code? Just askin'...


Hi,

I have installed Spreadsheet::ParseExcel in my Unix Machine. When i am trying to call this Module using the below mentioned script, It is giving me a error saying that" Module cannot be found"

use strict;
use Spreadsheet::ParseExcel;

my $excel = Spreadsheet::ParseExcel::Workbook->Parse(Excel File1.xls);
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->{Val});
}
}
}
}

Could you please assist me on this and give me the correct code?

Thanks,

Aravind
Jul 24 '08 #4
numberwhun
3,503 Expert Mod 2GB
Are you sure that you included something like

#!/usr/bin/perl

at the top of your code? Just askin'...
Perler,

I think it would be a good idea for you to stick with the newest posts. This post is over 1 1/2 years old and I doubt that the user that posted it will even see it.

Also, to the point in your post, since they are working with excel spreadsheets, I assume that they were working on a Windows system. The shebang line (#!/usr/bin/perll) is typically ignored on a windows system, unless of course its CGI and then it would have the -T option after it and only then would it be read.

Regards,

Jeff
Jul 24 '08 #5
KevinADC
4,059 Expert 2GB
pssst......Jeff......

I have installed Spreadsheet::ParseExcel in my Unix Machine
Jul 24 '08 #6
numberwhun
3,503 Expert Mod 2GB
pssst......Jeff......
Ok, bad assumption on my part. Long day!
Jul 24 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Arvind P Rangan | last post: by
2 posts views Thread by karups | last post: by
reply views Thread by Raymond Chiu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.