Updated version of Excel gives "File Error: data may have been lost."

5171 views
Skip to first unread message

zeoliteman

unread,
Oct 9, 2007, 5:52:51 PM10/9/07
to Spreadsheet::WriteExcel

After updating Excel today and I get an error opening files generated
by Spreadsheet::WriteExcel.

"File Error: data may have been lost."

Here's a link I found which I think is related.

http://groups.google.com/group/microsoft.public.officeupdate/browse_thread/thread/ed728b05e3e68ef9/b8ba8861a632c593?lnk=st&q=excel+file+error+data+may+have+been+lost&rnum=1#b8ba8861a632c593

Has anyone experienced similar behaviour?

jmcnamara

unread,
Oct 10, 2007, 4:26:49 AM10/10/07
to Spreadsheet::WriteExcel
On Oct 9, 10:52 pm, zeoliteman <zeolite...@gmail.com> wrote:
> After updating Excel today and I get an error opening files generated
> by Spreadsheet::WriteExcel.

Hi,

I guess that you are referring to the Office Service Pack 3 (SP3)
update.

I installed it and tried it with S::WE version 2.20 and 60+ files from
the examples dir of the distro and didn't encounter any problems.

However, SP3 contains a previous security patch, KB918419, which
caused problems like you describe when using set_column() with an
invalid $last_col argument:

$worksheet->set_column(1, 1, 20); # OK
$worksheet->set_column(2, 0, 30); # Error!!

This was patched in S::WE version 2.18.

If you using a version before that then see if an upgrade fixes your
problem (or else check all of your set_column() statements).

If that doesn't fix the problem then let me know. Try to generate an
example program as follows:

http://groups.google.com/group/spreadsheet-writeexcel/browse_frm/thread/23c26520737d753b

John.
--

Micah

unread,
Oct 10, 2007, 11:44:13 AM10/10/07
to Spreadsheet::WriteExcel
You should note that there are many incompatibilities with the new
office, including Office 2007. Even this SIMPLE program produces an
error on my Vista machine with OFFICE 2007.

#!C:/Perl/bin/perl.exe -w
use strict;
use warnings;
use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new('test.xls' );
my $worksheet = $workbook -> add_worksheet();
$worksheet->write(0,0,'hello');
$worksheet->write(0,0,'goodbye');

__ END PROGRAM___

Opening the file in Office2007 yields the following error "File error:
data may have been lost", after which the file opens with only "hello"
showing in cell A1.

After installing, ExcelViewer2003 from Microsoft, and if I open the
excel specifically through that program, the file opens correctly and
without error, displaying only "goodbye" in A1.

It's VERY frustrating.

Perl version : 5.008008
OS name : MSWin32
Module versions: (not all are required)
Spreadsheet::WriteExcel 2.18
Parse::RecDescent 1.94
File::Temp 0.16
OLE::Storage_Lite 0.13
IO::Stringy 2.110
C:\Users\Micah\Desktop\PerlScripts>

Thanks,
- Micah

> http://groups.google.com/group/spreadsheet-writeexcel/browse_frm/thre...
>
> John.
> --

jmcnamara

unread,
Oct 10, 2007, 11:55:46 AM10/10/07
to Spreadsheet::WriteExcel
On Oct 10, 4:44 pm, Micah <micah...@gmail.com> wrote:
> You should note that there are many incompatibilities with the new
> office, including Office 2007. Even this SIMPLE program produces an
> error on my Vista machine with OFFICE 2007.
>
> #!C:/Perl/bin/perl.exe -w
> use strict;
> use warnings;
> use Spreadsheet::WriteExcel;
> my $workbook = Spreadsheet::WriteExcel->new('test.xls' );
> my $worksheet = $workbook -> add_worksheet();
> $worksheet->write(0,0,'hello');
> $worksheet->write(0,0,'goodbye');

Hi,

This is probably the problem that the OP was referring to above.

I can confirm that this also happens in Excel 2003 with Office SP3
applied.

Arrrrrrrrrrrrgh!!!!

John.
--


Micah

unread,
Oct 18, 2007, 9:23:17 AM10/18/07
to Spreadsheet::WriteExcel
Refering to the problem below, I've confirmed that this only applies
when you overwrite a cell that you have previously written to. I'm
currently using S::WE 2.20, and the problem still exists. If,
however, you find a way to have the program to write the contents and
formatting to a cell exactly once, the file opens without a problem on
these newer versions of Excel (i.e. Office 20007);

Just thought I would add.

-- micah

cai xingliang

unread,
Sep 8, 2013, 5:20:49 AM9/8/13
to spreadsheet...@googlegroups.com
Add this line and it will fix the problem. It works on my excel 2010 and Spreadsheet::WriteExcel 2.37.
$workbook->compatibility_mode();

....

Xingliang
Reply all
Reply to author
Forward
0 new messages