use Win32::OLE; my $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 0; $xlApp->{DisplayAlerts} = 0; # Open excel file. my $xlBook = $xlApp->Workbooks->Open("C:\\Documents and Settings\\username\\Desktop\\testfile.xls"); my $Sheet1 = $xlBook->Worksheets(1); my $row = 1; my $col = 1; $Sheet1->Cells($row,$col)->{'Value'} = 5; if (Win32::OLE->LastError) { print "File protected"; } $xlBook ->Close(); undef $xlBook;