donnytian / Npoi.Mapper

Use this tool to import or export data with Excel file. The tool is a convention based mapper between strong typed object and Excel data via NPOI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Take<dynamic> but always take a text column

BobBonser opened this issue · comments

I am having using the dynamic take with some excel files. Specifically with files that have columns that are a mixture of alpha-numeric and all numeric columns. It set the datatype as a double column if the first entry is numeric and then when it encounters an alpha-numeric entry it errors and sets the value to 0.

What I want to do is read the entire sheet as a text column no matter what the data is in in the Excel file.

Is there anyway to do that??

var mapper = new Mapper(workbook);
var sheetRowData = mapper.Take(sheet.SheetName);

If you can manually process the Excel file, pls open it, then format the first data cell on that column as Text.
There is no way by code so far. The code infers the data type by the cell format.

fixed in next release