Read Excel with ASP.NET – C# source code

  • Home
  • /
  • Articles
  • /
  • Read Excel with ASP.NET – C# source code

Read Excel with ASP.NET tutorial shows how to read data from Excel file in ASP.NET using C# with Bytescout Spreadsheet SDK. Use the source code below to read Excel files.

C#

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;


......
           // Create new Spreadsheet object to read from given excel 
           Spreadsheet document = new Spreadsheet();

           // read excel file (supports xls excel, xlsx excel, csv, ods)
          document.LoadFromFile("Hello_world.xlsx");

           // Get worksheet by name
           Worksheet worksheet = document.Workbook.Worksheets.ByName("Sheet1");

           // Read cell value
           string value = worksheet.Cell(0, 0).ValueAsString;

.....
prev
next