Help upload excel sheets to dataset

Hi,

Can I get sample code for uploading large excel data to dataset? I want a dialog for user to choose any excel file for uploading. Thanks!


1 Reply

MW Melba Winshia Syncfusion Team October 17, 2007 02:07 PM UTC

Hi Jane,

We regret for the delayed response.

If your intention is to upload excel data to dataset, it can be achieved by using IWorksheet.ExportDataTable method.

[C#]

//The first worksheet object in the worksheets collection is accessed.
IWorksheet sheet = workbook.Worksheets[0];

//Get as DataTable
DataTable datatable = sheet.ExportDataTable(sheet.UsedRange, ExcelExportDataTableOptions.ColumnNames);

//Upload to dataset
DataSet ds = new DataSet();
ds.Tables.Add(datatable);

Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/XlsIO.Windows/68452/main.htm

If I have misunderstood your requirement, could you please explain me in detail, so that I can work in depth and try to send a better solution?

Thanks,
Melba

Loader.
Up arrow icon