Hello,
I’ve been trying to get the ExportDataTable feature working for quite some time now and have absolutely no clue what I’m doing wrong but the overloaded form of this method with the column indexes doesn’t seem to work.
My sample code is:
// Same order as the Excel sheet has
DataTable data = new DataTable();
data.Columns.Add(“Name”);
data.Columns.Add(“Num”);
data.Columns.Add(“Date”);
int[] cols = {2}; // changing this value does nothing
worksheet.Cells.ExportDataTable(data, 0, cols, 100, false);
When the code runs, the DataTable data contains only the first column of Data from the excel table, but I specified the index 2, so shouldn’t it just be Date? I’ve tried several variations of this code and it always seems to just ignore the column indexes and return the first n columns. Any help would be appreciated. For now I’ll just be copying the entire data set, then filtering manually. Thanks!