1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!"C:\xampp\perl\bin\perl.exe" -w
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...
print "Content-type: text/html\n\n";
my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{Visible} = 1; # ??
my $Book = $Excel->Workbooks->Open("datei1.xls"); # open Excel file
my $Sheet = $Book->Worksheets(1); # select worksheet number 1 (you can also select a worksheet by name)
foreach my $row (1..10){
foreach my $col (1..4) {
my $Val = $Sheet->Cells($row,$col)->{'Value'}; # shows value
my $Dis = $Sheet->Cells($row,$col)->{'Text'}; # shows formated value
my $Form = $Sheet->Cells($row,$col)->{'Formula'}; # shows formula
print "$row, $col, $Dis, $Val, $Form<br>\n";
}
print "<br>\n";
}
# hier soll irgendwas modifiziert werden
$Book->Close;
print "ready<br>\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!"C:\xampp\perl\bin\perl.exe" -w
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
print "Content-type: text/html\n\n";
my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{Visible} = 1;
my $Book = $Excel->Workbooks->Open("C:/xampp/cgi-bin/neoplast/rw_excel/datei1.xls");
my $Sheet = $Book->Worksheets(1);
foreach my $row (1..10){
foreach my $col (1..4) {
my $Val = $Sheet->Cells($row,$col)->{'Value'}; # shows value
my $Dis = $Sheet->Cells($row,$col)->{'Text'}; # shows formated value
my $Form = $Sheet->Cells($row,$col)->{'Formula'}; # shows formula
print "$row, $col, $Dis, $Val, $Form<br>\n";
}
print "<br>\n";
}
$Sheet->Cells(3,5)->{'Value'} = "1";
my $value = $Sheet->Cells(3,5)->{'Value'};
$Book->Close;
print "ready<br>\n";