'Is Spire.XLS C# support HDR - option when Excel file has no header file?
Is Spire.XLS C# support HDR - option when Excel file has no header file ? I have Excel file without header file. This is resolved in OLEDB driver in connection string HDR="No" Option.
Solution 1:[1]
You can use the ExportDataTable(CellRange range, bool exportColumnNames) method of Spire.Xls.Worksheet class to read worksheet data into a data table and determine whether to export the first row in the worksheet range as header row in the data table.
Example:
private void button1_Click(object sender, EventArgs e)
{
Workbook workbook = new Workbook();
workbook.LoadFromFile("Input.xlsx");
Worksheet sheet = workbook.Worksheets[0];
DataTable dt = sheet.ExportDataTable(sheet.Range, false);
dataGridView1.DataSource = dt;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

