Bad excel docs with Spreadsheet::WriteExcel::Simple

E

Erica

I've been trying to create an excel document with
SpreadSheet::WriteExcel::Simple on Windows 2000 Server, and open it
with MS Excel 7.0 (old, I know, but all my more recent copies seem to
be on bad CDs).
A 6.0 KB file is created, but when I try open the Excel file in Excel
I get an error, "Cannot access xxx.xls."

This is what I'm doing:
use Spreadsheet::WriteExcel::Simple;

$ss = Spreadsheet::WriteExcel::Simple->new;
@headings = ("One", "Two", "Three");
@headings = ("1", "2", "3");
$ss->write_bold_row(\@headings);
$ss->write_row(\@data);
open FILE, ">xxx.xls";
print FILE $ss->data;
close FILE;

Does anyone have any ideas about what I might be doing wrong?

Thanks,
Erica
 
J

Jay Tilton

(e-mail address removed) (Erica) wrote:

: I've been trying to create an excel document with
: SpreadSheet::WriteExcel::Simple on Windows 2000 Server, and open it
: with MS Excel 7.0 (old, I know, but all my more recent copies seem to
: be on bad CDs).
: A 6.0 KB file is created, but when I try open the Excel file in Excel
: I get an error, "Cannot access xxx.xls."
:
: This is what I'm doing:
: use Spreadsheet::WriteExcel::Simple;
:
: $ss = Spreadsheet::WriteExcel::Simple->new;
: @headings = ("One", "Two", "Three");
: @headings = ("1", "2", "3");
: $ss->write_bold_row(\@headings);
: $ss->write_row(\@data);
: open FILE, ">xxx.xls";
: print FILE $ss->data;
: close FILE;
:
: Does anyone have any ideas about what I might be doing wrong?

An Excel worksheet file contains binary data.
binmode() the filehandle before writing.
 
J

John M. Gamble

(e-mail address removed) (Erica) wrote:

: I've been trying to create an excel document with
: SpreadSheet::WriteExcel::Simple on Windows 2000 Server, and open it
: with MS Excel 7.0 (old, I know, but all my more recent copies seem to
: be on bad CDs).
: A 6.0 KB file is created, but when I try open the Excel file in Excel
: I get an error, "Cannot access xxx.xls."
:
: This is what I'm doing:
: use Spreadsheet::WriteExcel::Simple;
:
: $ss = Spreadsheet::WriteExcel::Simple->new;
: @headings = ("One", "Two", "Three");
: @headings = ("1", "2", "3");
: $ss->write_bold_row(\@headings);
: $ss->write_row(\@data);
: open FILE, ">xxx.xls";
: print FILE $ss->data;
: close FILE;
:
: Does anyone have any ideas about what I might be doing wrong?

An Excel worksheet file contains binary data.
binmode() the filehandle before writing.

Also, i suspect the second @headings assignment was meant to be
a @data assignment. I know, i'm critiquing an example, but just
in case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top