Hi,
What is the easiest way to import a excel file to a dataset?
Thanks,
JB
Hi,
What is the easiest way to import a excel file to a dataset?
Thanks,
JB
Hi,
Thank you for considering Aspose.
You can use ExportDataTable() and ExportDataTableAsString() methods to Export the data from your worksheet to a DataTable and then you can add that DataTable to your DataSet. Please see the following Sample Code in this regard,
Sample Code:
Workbook workbook = new Workbook();
workbook.Open(@"d:\test\MyFile.xls");
Worksheet worksheet = workbook.Worksheets[0];
DataTable dataTable = new DataTable();
dataTable = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxColumn + 1);
dataTable.AcceptChanges();
DataSet ds = new DataSet();
ds.Tables.Add(dataTable);
Please see the following Links which will help you understand the different Export methods provided in Aspose.Cells.
Thank You & Best Regards,
Hi,
We are not considering it, we bought it it is a great tool
Thanks for the example.