From 523af580d09442473b456ce9318c2e46d4d6573f Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Thu, 6 Nov 2025 11:07:18 +0530 Subject: [PATCH] 988142-DataTable --- .../Excel-Library/NET/Import-Export/Export-from-Excel.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Document-Processing/Excel/Excel-Library/NET/Import-Export/Export-from-Excel.md b/Document-Processing/Excel/Excel-Library/NET/Import-Export/Export-from-Excel.md index 9d0bfec88..f88ea5741 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Import-Export/Export-from-Excel.md +++ b/Document-Processing/Excel/Excel-Library/NET/Import-Export/Export-from-Excel.md @@ -25,8 +25,13 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; - //Read data from the worksheet and Export to the DataTable - DataTable customersTable = worksheet.ExportDataTable(worksheet.UsedRange, ExcelExportDataTableOptions.ColumnNames | ExcelExportDataTableOptions.ComputedFormulaValues); + //Read all data from the used range of worksheet and Export to the DataTable + DataTable customersTable = worksheet.ExportDataTable(worksheet.UsedRange, ExcelExportDataTableOptions.ColumnNames | ExcelExportDataTableOptions.ComputedFormulaValues); + + IRange range = worksheet.Range["A1:B10"]; + + //Read specified range from the worksheet and Export to DataTable + DataTable customersTable1 = worksheet.ExportDataTable(range, ExcelExportDataTableOptions.ColumnNames | ExcelExportDataTableOptions.ComputedFormulaValues); } //XlsIO supports binding of exported data table to data grid in Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms alone.