Schrift
[thread]8451[/thread]

Perl und Spreadsheets

Leser: 2


<< >> 3 Einträge, 1 Seite
esskar
 2006-10-26 11:35
#71188 #71188
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
gibt es ein modul, dass ich nutzen kann, um zu einer existierenden xls-datei ein worksheet hinzuzufügen?
esskar
 2006-10-26 11:37
#71189 #71189
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
ich hab z.b. folgendes versucht

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
my $oldworkbook;
if(-e $filename) {
$oldworkbook = Spreadsheet::ParseExcel::Workbook->Parse($filename);
}

my $workbook = Spreadsheet::WriteExcel->new($filename);
if(defined $oldworkbook) {
for(my $i = 0; $i < $oldworkbook->{SheetCount}; $i++) {

my $ws = $oldworkbook->{Worksheet}[$i];

my $worksheet = $workbook->add_worksheet($ws->{Name});
for(my $row = $ws->{MinRow}; defined $ws->{MaxRow} && $row <= $ws->{MaxRow}; $row++) {
for(my $col = $ws->{MinCol}; defined $ws->{MaxCol} && $col <= $ws->{MaxCol}; $col++) {
my $cell = $ws->{Cells}[$row][$col];
$worksheet->write($row, $col, $cell->Value);
}
}
}
}


aber dann wirft er mir immer

Can't call method "Value" on an undefined value an den kopf
esskar
 2006-10-26 11:41
#71190 #71190
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
ich dusel

Code: (dl )
1
2
$worksheet->write($row, $col, $cell->Value) 
if defined $cell;


ist natürlich der bringer!
<< >> 3 Einträge, 1 Seite



View all threads created 2006-10-26 11:35.