Return-Path: | <lealvf [...] gmail.com> |
X-Original-To: | bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org |
Delivered-To: | cpan-bug+spreadsheet-parseexcel-simple [...] diesel.bestpractical.com |
Received: | from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id B19884D801A for <bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org>; Tue, 10 Jan 2006 00:05:02 -0500 (EST) |
Received: | (qmail 6276 invoked by alias); 10 Jan 2006 05:04:33 -0000 |
X-Spam-Status: | No, hits=-2.6 required=8.0 tests=BAYES_00,DK_SIGNED,DK_VERIFIED,SPF_PASS |
X-Spam-Check-BY: | la.mx.develooper.com |
Received-SPF: | pass (x1.develooper.com: domain of lealvf [...] gmail.com designates 64.233.162.201 as permitted sender) |
Received: | from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.201) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 09 Jan 2006 21:04:28 -0800 |
Received: | by zproxy.gmail.com with SMTP id j2so3532466nzf for <bug-Spreadsheet-ParseExcel-Simple [...] rt.cpan.org>; Mon, 09 Jan 2006 21:04:25 -0800 (PST) |
Domainkey-Signature: | a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:in-reply-to:x-mimeole:message-id; b=eXbQiTbsWcgi9akH2WNrclnXVnLvboIUNcViNO8mt+eg2CF5XYXDDswlBUxaIQn4a8cMCM91WjajxsPFM63SIHkLMF/gbeLj/iAQKUuY6XuS8yESDx6Hfx6Gnr21r+/7dNx/7LJk3aJ5ecpMdyZwSpHul5vmzE7HQz2YQuYTuQ4= |
Received: | by 10.37.14.45 with SMTP id r45mr6449679nzi; Mon, 09 Jan 2006 21:04:24 -0800 (PST) |
Received: | from USVLEAL ( [12.35.57.131]) by mx.gmail.com with ESMTP id 18sm3152393nzo.2006.01.09.21.04.23; Mon, 09 Jan 2006 21:04:24 -0800 (PST) |
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 |
MIME-Version: | 1.0 |
Content-Type: | text/plain; charset="us-ascii" |
Content-Transfer-Encoding: | 7bit |
X-Mailer: | Microsoft Office Outlook, Build 11.0.6353 |
Thread-Index: | AcYR2giDcZYMXVYOSh6WWMucyM6GRgDxxtcg |
In-Reply-To: | <rt-16920-50992.9.25611402354619 [...] cpan.org> |
X-Mimeole: | Produced By Microsoft MimeOLE V6.00.2900.2527 |
Message-Id: | <43c34058.7b2bde9f.4a64.7509 [...] mx.gmail.com> |
X-RT-Original-Encoding: | us-ascii |
Content-Length: | 2049 |
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