in reply to Spreadsheet Parsing problem

<guess>

If the spreadsheets are on a Win32 platform and the Perl is on a Unix platform, the newline character ($/) might be getting munged. On Unix, it's \n and on Win32, it's \r\n (or \n\r?). Might want to check into that.

</guess>

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Spreadsheet Parsing problem
by flounder99 (Friar) on Apr 29, 2003 at 19:05 UTC
    I added a bindmode STDOUT
    use strict; use warnings; use Spreadsheet::ParseExcel::Simple; use Spreadsheet::WriteExcel::Simple; binmode STDOUT; #IN my $file = 'infile.xls'; my $xls = Spreadsheet::ParseExcel::Simple->read($file); #OUT my $ss = Spreadsheet::WriteExcel::Simple->new(); my $count; foreach my $sheet ($xls->sheets) { while ($sheet->has_data) { #Reading my @idata = $sheet->next_row; my @odata = @idata; # Here I can manipulate the data #Writing $ss->write_row(\@odata); last if $count++ > 5; } } print $ss->data;
    and ran
    perl temp.pl >outfile.xls
    and oufile.xls opened fine. I tried a several different versions of infile.xls with blank rows and such but it seemed to work fine.

    --

    flounder

Re: Re: Spreadsheet Parsing problem
by artist (Parson) on Apr 29, 2003 at 18:16 UTC
    They both are on windows NT 4.0 platform.
    version info:
    perl:  v5.6.0 (Activestate) build 623
    Spreadsheet-ParseExcel-Simple 1.01 
    Spreadsheet-WriteExcel-Simple 0.03
    
    artist
Re: Re: Spreadsheet Parsing problem
by halley (Prior) on Apr 29, 2003 at 18:52 UTC

    If you have to start talking about the distinctions between bytes, don't refer to the semantic names "\r" and "\n". Instead, start discussing them with hex or octal literal values and specify the binary mode.

    On Unix, ("\n" eq "\x0A"). On Windows, perl will memorize it the same way, except treat any ("\n" eq "\x0D\x0A") on input or output, doing conversions if the stream is not binmode().

    --
    [ e d @ h a l l e y . c c ]