Skip Menu |

This queue is for tickets about the Spreadsheet-ParseExcel-Simple CPAN distribution.

Report information
The Basics
Id: 16920
Status: new
Priority: 0/
Queue: Spreadsheet-ParseExcel-Simple

People
Owner: Nobody in particular
Requestors: lealvf [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Thu, 5 Jan 2006 01:00:36 -0500
From: Victor Leal <lealvf [...] gmail.com>
To: bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org
Subject: Convert Excel to Text (Spreadsheet::ParseExcel::Simple;)
I have the following code that takes an excel spreadsheet and converts it to a PIPE delimited text file. However, this will create a text file for EVERY tab and what I would like to do is tell the script which specific tab in a spreadsheet to use. For example, if I have a tab called "employee" I would like to pass in a parameter value of "employee" to my Perl script and it converts that excel file's tab to a pipe delimited format. Any ideas on how I could accomplish this? #### BEGIN CODE #### use Spreadsheet::ParseExcel::Simple; # These are my parameters that I am passing in my ($p_src_file) = @ARGV[0]; my ($p_sheet) = @ARGV[1]; my ($p_target_file) = @ARGV[2]; my $xls = Spreadsheet::ParseExcel::Simple->read($p_src_file) or die "Can't read $p_src_file: $!\a"; my $index = 1; foreach my $sheet ($xls->sheets) { open(TXT, ">$p_target_file$index.TXT"); while ($sheet->has_data) { my @row = $sheet->next_row; foreach (@row) { if (/[,"]/) { s/"/""/g; s/^/"/; s/$/"/; } } print TXT join('|', @row), "\n"; } close TXT; } continue { $index++; } #### END CODE ####
Date: Thu, 5 Jan 2006 09:25:42 +0000
From: Tony Bowden <tony [...] kasei.com>
To: Victor Leal via RT <bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org>
Subject: Re: [cpan #16920] Convert Excel to Text (Spreadsheet::ParseExcel::Simple;)
RT-Send-Cc:
On Thu, Jan 05, 2006 at 01:01:17AM -0500, Victor Leal via RT wrote: Show quoted text
> For example, if I have a tab > called "employee" I would like to pass in a parameter value of > "employee" to my Perl script and it converts that excel file's tab to a > pipe delimited format. Any ideas on how I could accomplish this? > foreach my $sheet ($xls->sheets) {
next unless $sheet->sheet->{Name} eq $wanted; Tony