Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Error in excel reader

by davies (Prior)
on Jan 02, 2019 at 14:44 UTC ( [id://1227924]=note: print w/replies, xml ) Need Help??


in reply to Error in excel reader

use strict; use warnings; use Win32::OLE; use feature 'say'; my $Excel = Win32::OLE->new('Excel.Application'); $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Add; for my $nSht (2..$Book->Sheets->{Count}) { $Book->Sheets(2)->Delete; } my $Sheet = $Book->Sheets(1); say $Sheet->UsedRange->Find('Go'); $Sheet->Cells(3,4)->{Value} = 'Go'; say $Sheet->UsedRange->Find('Go')->Address; $Excel->{DisplayAlerts} = 0; $Excel->Quit;

You may be over-complicating things. The only real complication in the SSCCE above is that Find returns undef if it fails. That is the difference in my two say statements - an undefined object cannot have an address. You may need to test for this, but I don't have your files and so can't know.

Regards,

John Davies

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227924]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found