ExcelWorksheetExtractToDataTable Method

Note: This API is now obsolete.

Extracts data to DataTable with the same column order as it is in ExcelWorksheet.

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version:
[ObsoleteAttribute("Use 'GemBox.Spreadsheet.ExcelWorksheet.ExtractToDataTable(System.Data.DataTable, GemBox.Spreadsheet.ExtractToDataTableOptions)' method instead. For more info, see https://www.gemboxsoftware.com/spreadsheet/help/html/Obsolete_Members.htm#ExcelWorksheetExtractToDataTable.")]
public void ExtractToDataTable(
	DataTable dataTable,
	int numberOfRows,
	ExtractDataOptions options,
	ExcelRow startRow,
	ExcelColumn startColumn


Type: System.DataDataTable
Destination DataTable.
Type: SystemInt32
Number of rows to extract.
Type: GemBox.SpreadsheetExtractDataOptions
Options that describe how data will be extracted.
Type: GemBox.SpreadsheetExcelRow
Start ExcelRow.
Type: GemBox.SpreadsheetExcelColumn
Start ExcelColumn.

DataTable has to have all the columns defined before calling this method. Because DataColumnMapping objects are not used in this method, columns in DataTable have to have the same order as columns in ExcelWorksheet (starting from column defined in startColumn argument).

You can customize error handling by using ExtractDataEvent.

DataTable column type and corresponding cell value type need to be 'similar' data types. If that's not the case, then exception would be thrown. Note that numbers and string are not 'similar' data types. Numbers wouldn't be automatically converted to strings because of culture issues; someone would expect the number 12.4 is converted to "12.4" and someone else to "12,4". To make custom conversion, use ExtractDataEvent.

See Also