Null as string

Hi,

actualDatacells.ExportDataTableAsString(0, 0, actualDatacells.MaxDataRow + 1, actualDatacells.MaxDataColumn + 1, true);

I am using this method to export the data from cells to DataTable, but i have empty values in cell of excel, those should be null in DataTable, but it is being exported as empty string.It should be null, How can i fix this

@Amrinder_Singh,

Could you please share your template Excel file (please zip the file prior attaching) to evaluate your issue on our end. By the way, you may try to use Cells.ExportDataTable() overloaded method instead and set some attributes of ExportDataTable accordingly. The code could be like following:

......
ExportTableOptions options = new ExportTableOptions();
options.AllowDBNull = true;
options.ExportColumnName = true;
options.ExportAsString = true;

actualDatacells.ExportDataTable(0, 0, actualDatacells.MaxDataRow + 1, actualDatacells.MaxDataColumn + 1,options);

Let us know if the above code works for your needs.

Yes, i tried that also, it is working as expected, Thank you so much for the Quick help

@Amrinder_Singh
You are welcome. I’m glad your issue has been resolved. If you have any questions, please feel free to contact us.