Import Data from Excel to Datatable

  • Demo
  • C# source
  • VB.Net source
This demo shows you how to read data from an excel workbook and export data.
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at
Any question related to the purchase of product, contact us at
If you don't find the demo you want, please contact for the free customized demo just for you.
using System.Data;
using Spire.Xls;

namespace DemoOnlineCode
    class ImportDatafromExceltoDatatable
        public void demoImportDatafromExceltoDatatable(string filePath,string resultFilePath)
            Workbook book = new Workbook();
            DataTable table = book.Worksheets[0].ExportDataTable();
            Workbook data_book = new Workbook();


Imports System.Data
Imports Spire.XLS

Namespace DemoOnlineCode
    Class ImportDatafromExceltoDatatable
        Public Sub demoImportDatafromExceltoDatatable(filePath As String, resultFilePath As String)
            Dim book As New Workbook()
            Dim table As DataTable = book.Worksheets(0).ExportDataTable()
            Dim data_book As New Workbook()
            data_book.Worksheets(0).InsertDataTable(table, True, 1, 1)
            data_book.SaveToFile(resultFilePath, ExcelVersion.Version2010)

        End Sub

    End Class
End Namespace