Strings become dates

When I import a csv file in an Excel sheet with Flexcel some strings become dates. E.g. '08-4' becomes '8-4-2018'. Is there a general option in Flexcel to avoid this kind of automatic conversions?


by default, FlexCel uses the conversions windows itself uses, and Windows can go out of its way to convert stuff that "looks like" something else.


But we provide a lot of options to "tame" this conversion to be more like you want it. If you are using Xls.Import: http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.XlsAdapter/TXlsFile/Import.html
Then the relevant options are:
columnFormats
dateFormats

With the columnFormats parameter, you can mark some columns to be imported as text instead of trying to convert them to numbers or dates.
With the dateFormats parameter, you can tell FlexCel which are the valid date formats that you want to convert (or set it to an empty array to not convert any value to dates). So for example you can specify that "yyyy-mm-dd" is a valid date format (and FlexCel should try to convert those), but others like "08-4" will not be.

If you are using XlsFile.Open, there are similar parameters too in that method:
http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TExcelFile/Open.html#texcelfileopenstring-tfileformats-char-integer-integer-tcolumnimporttypearray-tarraystring-tencoding-boolean

Thank you for this super fast answer Adrian.