Hi,
I have a table with multiple columns with custom headers. I need to extract only two columns from this sheet knowing their column headers/labels in order to export them to database. How is this possible?
Thanks
This message was posted using Aspose.Live 2 Forum
Hi,
Well, I think you may try to fill datatable(s) based on your desired column in the worksheet, so later your may use your own .NET API to fill it to your database. Alternatively, you may fill two dimensional array for your need.
Some useful functions for the Aspose.Cells.Cells class are:
ExportDataTable(), ExportArray().
Sample code:
//Get the first worksheet in the workbook
Worksheet worksheet = worksheet = workbook.Worksheets[0];
ExportTableOptions options = new ExportTableOptions();
options.ExportColumnName = true;
//Extract/Export “A” Column with its heading in the sheet to fill to datatable.
DataTable dt = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxDataRow +1, 1, options);
Thank you.