Ratazong has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
I'm using Win32::OLE to work with Excel (and I am happy with it). However I am stuck with the following issue:
A cell I access should contain a date. Therefore I read it using
which works fine - as long as Excel thinks the cell contains a date. Unfortunately, in some sheets the date is stored as a string - so I should read the {'value'} instead of the {FormulaR1C1} and parse it myself.@val = $WPsheet->Range("A1")->{FormulaR1C1}
What is the best (most robust) way to find out if the date is stored as an "Excel-date" or an "Excel-string"?
Rata
Update: Thanks for your hints, davies and priyaviswam. I decided to go the "value eq value2"-approach for now ... but will keep the format-approach in mind.
@davies When creating my inital code, I somewhere found @val and using the formula-property - and it worked. So there is no reason to keep it other than cargo-cult.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE Excel: identify cell-format
by davies (Monsignor) on Nov 16, 2011 at 10:05 UTC | |
|
Re: Win32::OLE Excel: identify cell-format
by priyaviswam (Sexton) on Nov 16, 2011 at 10:19 UTC |