Skip Menu |

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

Report information
The Basics
Id: 16983
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)



From: "Victor Leal" <lealvf [...] gmail.com>
To: <bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org>
Subject: Convert Excel to Text (Spreadsheet::ParseExcel::Simple;) Part 2
Date: Tue, 10 Jan 2006 00:04:24 -0500
This is another question/maybe bug in regards to the following code seen later below. The code takes an excel spreadsheet and converts it to a PIPE delimited text file. This script will create a text file for a SPECIFIC Excel tab. I have an issue with SOME spreadsheets where I will specify a specific sheet to select but it will pick the sheet 3 tabs over to the one I specify. Any ideas on why on some Excel files it would select the sheet 3 tabs over? =====BEGIN PERL SCRIPT===== use Spreadsheet::ParseExcel::Simple; my ($p_src_file) = @ARGV[0]; my ($p_sheet) = @ARGV[1]; my ($p_target_file) = @ARGV[2]; $p_src_file =~ /(.*)\.xls$/i or die "Invalid filename: $p_src_file\a"; my $xls = Spreadsheet::ParseExcel::Simple->read($p_src_file) or die "Can't read $p_src_file: $!\a"; foreach my $sheet ($xls->sheets) { next unless $sheet->sheet->{Name} eq $p_sheet; print("The $p_target_file file has been created!\n"); open(TXT, ">$p_target_file.TXT"); print($sheet->sheet->{Name}); 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 PERL===== Show quoted text
-----Original Message----- From: Tony Bowden via RT [mailto:comment-Spreadsheet-ParseExcel-Simple@rt.cpan.org] Sent: Thursday, January 05, 2006 4:26 AM To: lealvf@gmail.com Subject: Re: [cpan #16920] Convert Excel to Text (Spreadsheet::ParseExcel::Simple;) Full context and any attached attachments can be found at: <URL: http://rt.cpan.org/NoAuth/Bug.html?id=16920 > On Thu, Jan 05, 2006 at 01:01:17AM -0500, Victor Leal via RT wrote:
> 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