Hi Bruce,
The real kicker for me is dates, where months/days may swap places; likely formats for times can be unambiguously parsed with the right regular expression. If I could detect that a returned date had a number underlying it and (thus was in the machine’s short date format) then I would record the short date format active at that time and, if the file was loaded on a computer with a different short date format, I would (for each cell):
While this is complicated, I cannot think of another way to deal with a column that may have a mixture of text and numeric dates. (To put this in context, such data is presented to our users as a column of text, to which we will apply an automatically-chosen parser, or one that the user manually chooses/writes. This parser will continue to behave properly in this scheme.)
I can understand that this change would break the CSV-ish abstraction so I’ll understand if you consider it inappropriate.
Regards,
Oliver
--
You received this message because you are subscribed to the Google Groups "CSVChat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to csvchat+u...@googlegroups.com.
To post to this group, send email to csv...@googlegroups.com.
Visit this group at https://groups.google.com/group/csvchat.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to csvchat+unsubscribe@googlegroups.com.
Hi Bruce,
Exposing NumberFormat would do the job, but it might be confusing because CsvReader is not actually using the format stored in Excel when converting the numbers to strings (but is using the default short date/time format). I’m not arguing for it to change its formatting, since that would only complicate the issue.
How about adding a Values2 property (a homage to Excel’s Range.Value2) which is of type object[], containing strings, doubles or DateTimes (Kind.Unknown)? This would have the benefit that you could load numbers and dates precisely, with no loss of precision/decimal places that might otherwise occur because they are going via strings, and library users might not parse them exactly right (e.g. not using the correct round trip format specifiers). This is also attractive because the reader knows this data’s type, so why not preserve it?
Obviously CSV files would always return strings in this array.
We are certainly willing to upgrade to the source code licence, but we would prefer not to do the implementation work ourselves. Could we pay extra to have this feature added more generally?
Regards,
Oliver
--
You received this message because you are subscribed to the Google Groups "CSVChat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to csvchat+u...@googlegroups.com.