Read and write Excel files in ASP.NET (VB.NET) with Bytescout Spreadsheet SDK

  • Home
  • /
  • Read and write Excel files in ASP.NET (VB.NET) with Bytescout Spreadsheet SDK

Read and write Excel XLS, XLSX, CSV files
in your ASP.NET applications. For VB developers.

Bytescout Spreadsheet SDK is a clean and simple API to read and write Excel files.

Almost in every business application we need to have the ability to read and write Excel files. Using Bytescout Spreadsheet SDK is a simple way of reading and writing Excel files using Visual Basic.

Sample source code – write data to Excel file in VB.NET:

Imports Bytescout.Spreadsheet
Imports System.IO

Module Module1

    Sub Main()
        Dim document As New Spreadsheet()

        Dim worksheet As Worksheet = document.Workbook.Worksheets.Add("HelloWorld")

        worksheet.Cell(0, 0).Value = "Hello, World!"

        ' remove output file if already exists
        If File.Exists("Output.xls") Then
            File.Delete("Output.xls")
        End If

        ' Save document
        document.SaveAs("Output.xls")

        ' Close Spreadsheet
        document.Close()

        ' open in default spreadsheets viewer/editor
        Process.Start("Output.xls")

    End Sub

End Module

Sample source code – read data from Excel file in VB.NET:

Imports Bytescout.Spreadsheet
Imports System.IO

Module Module1

    Sub Main()
        ' Create new Spreadsheet
        Dim document As New Spreadsheet()
        document.LoadFromFile("Hello_world.xlsx")

        ' Get worksheet
        Dim worksheet As Worksheet = document.Workbook.Worksheets.ByName("Sheet1")

        ' Read cell value
        Console.WriteLine("Cell (0,0) value: {0}", worksheet.Cell(0, 0).Value)

        ' Write message
        Console.Write("Press any key to continue...")

        ' Wait user input
        Console.ReadKey()
    End Sub

End Module

Find all sample source codes for Visual Basic and ASP.NET in a free trial of Spreadsheet SDK. Download now!

More about Bytescout Spreadsheet SDK benefits

Tutorials: