Excel to SQL and DataGrid via DataTable

Convert XLSX, XLS, XLSM, XLTX, CSV and TSV file to a System.Data.DataTable for full interoperability with System.Data.SQL or to populate a DataGrid.

Input true to ToDataTable method to set the first row as column names of the table. The DataTable can populate a DataGrid.

You can download a file project from this link.

How to Convert Excel to SQL DataTable in C#

  1. Install an Excel library to convert Excel to SQL DataTable.
  2. Load an existing Excel file.
  3. Select the default Worksheet
  4. Create a DataTable from data using ToDataTable.
  5. Process values iteratively.