ByteScout Spreadsheet SDK – VB.NET – Add Columns Into Existing Spreadsheet

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – VB.NET – Add Columns Into Existing Spreadsheet

ByteScout Spreadsheet SDK – VB.NET – Add Columns Into Existing Spreadsheet

Module1.vb

Imports Bytescout.Spreadsheet
Imports System.IO

Module Module1

    Sub Main()
        ' Open Spreadsheet
        Dim document As New Spreadsheet()
       document.LoadFromFile("AdvancedReport.xls")

        ' Get Worksheet
        Dim worksheet As Worksheet = document.Workbook.Worksheets(0)

        ' Add new Column
        worksheet.Columns.Insert(3, 1)

        ' Set values
        worksheet.Rows(0)(2).Value = "Age"

        ' 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


  Click here to get your Free Trial version of the SDK

prev
next