Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Spreadsheet::read how to get error?

by gsd4me (Beadle)
on Jul 18, 2018 at 21:32 UTC ( #1218790=perlquestion: print w/replies, xml ) Need Help??

gsd4me has asked for the wisdom of the Perl Monks concerning the following question:


I have a program that writes some data into a spreadsheet, which I want to then analyse again to produce some HTML output. The latter part works in testing but putting the whole lot together has raised an interesting problemette. Code replicated below. My debugging is showing that $gOutWorkbook has a value of "undef" upon return from ReadData, and I have no means of knowing why the workbook is not being (re-)opened to be read, when I have populated it with data previously (not shown here)

So: can I find out the reason *why* the workbook is not being opened properly? (ie some error value from somewhere) I have even put a 10 second delay before I attempt the open, to allow the OS to 'settle down' after closing the file, post writing to it but that doesn't help at all All other variables have relevant and correct values associated with them at the crucial point in the software. Previous ReadData calls work in other parts of the software suite, so it is only this section that is letting me down.

# Re-open as a read only # Read in the workbook and all its data $gOutWorkbook = ReadData ($lOutputFileName); $gOutWorksheet = $gOutWorkbook->[$gOutWorkbook->[0]{sheet}{"my +Sheet"}];

Replies are listed 'Best First'.
Re: Spreadsheet::read how to get error?
by kevbot (Priest) on Jul 19, 2018 at 05:28 UTC
    Hi gsd4me,

    I think you will need to provide more information in order to receive helpful feedback. The documentation for Spreadsheet::Read shows that you can pass a debug option to the ReadData method. Try changing your call to ReadData like this,

    $gOutWorkbook = ReadData ($lOutputFileName, debug => 9);
    and then examine the output for useful error messages.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1218790]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-11-28 15:00 GMT
Find Nodes?
    Voting Booth?