Free Support Forum -

How to export xlsm to dataset


I followed your demo to export xlsm file to datatable, which works fine. I have 20 tables in xlsm file, how could I export it to dataset (each tab map a to datatable in the dataset)?

Here is the code I from your demo.

            //Instantiate a new workbook
            Workbook workbook = new Workbook(path);
            //Get the first worksheet in the workbook
            Worksheet worksheet = workbook.Worksheets[4];
            //Create a datatable
            System.Data.DataTable dt = new System.Data.DataTable();
            //Export worksheet data to a DataTable object by calling either ExportDataTable or ExportDataTableAsString method of the Cells class		 	
            dt = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1,
                         worksheet.Cells.MaxColumn + 1);
        <SPAN style="COLOR: blue">return</SPAN> dt;</PRE>


Please refer to your other thread.
how to export xlsm to dataset