We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Import excel data into data table from filepath using aspose.cells

I want to import excel data from sheet into data table using aspose.cells. Sheet should be imported from filepath.

Can you pls say how to do for this.

Thanks in advance.

Hi Harish,


Thank you for contacting Aspose support.

I believe you are considering Aspose.Cells for .NET API therefore I will respond in perspective of .NET API. Coming back to your concerns, you may use the export features of Aspose.Cells for .NET APIs to export the Worksheet contents in an instance of DataTable. Please check the following piece of code for your reference.

C#

Workbook wb = new Workbook(“D:/Book1.xlsx”);
//Export all the data of the first worksheet to DataTable.
DataTable dt = wb.Worksheets[0].Cells.ExportDataTable(0, 0, wb.Worksheets[0].Cells.MaxDataRow + 1, wb.Worksheets[0].Cells.MaxDataColumn + 1);