Read XLS table .NET tutorial – C# sample

  • Home
  • /
  • Articles
  • /
  • Read XLS table .NET tutorial – C# sample

Read from XLS file to table in .NET using C# – this tutorial shows reading Excel files in .NET with Spreadsheet SDK. Use source code sample below to read data from XLS file in CSharp.

C#

 const string inputFile = @"PeriodicTableOfElementsSpreadsheet.xls";

           // Create new spreadsheet to read xls to table in .net
           Spreadsheet spreadsheet = new Spreadsheet();
           spreadsheet.LoadFromFile(inputFile);

           // Read XLS to table using Spreadsheet SDK
           DataTable dt = spreadsheet.ExportToDataTable();

           // Close spreadsheet object
           spreadsheet.Close();
prev
next