Getting Started with Spreadsheet SDK

  • Home
  • /
  • Getting Started with Spreadsheet SDK

To view the documentation for the SDK go to Start > All Programs > Bytescout Spreadsheet SDK and click the “Documentation” link.

The SDK comes with ready to use source code examples for Visual Basic, C#, ASP.NET, VB6*, VBScript*, ASP*

* requires .NET 1.10 or higher installed

To find source code samples please go to “My Documents” folder, “ByteScout Samples” and “Spreadsheet SDK”. Do not hesitate to copy and paste snippets from samples into your applications.

Make your first application to create and save XLS file

  • run Visual Studio and create a new project
  • add reference to Spreadsheet SDK using Project | Add Reference. In Add Reference dialog select Bytescout Spreadsheet SDK and click OK.
  • copy-and-paste the snippet:

Visual Basic:

Dim document As New Spreadsheet()

Dim worksheet As Worksheet = <span data-scayt_word="document.Workbook.Worksheets.Add" data-scaytid="344">document.Workbook.Worksheets.Add</span>("<span data-scayt_word="HelloWorld" data-scaytid="346">HelloWorld</span>")

<span data-scayt_word="worksheet.Cell" data-scaytid="348">worksheet.Cell</span>(0, 0).Value = "Hello, World!"

' remove output file if already exists
If <span data-scayt_word="File.Exists" data-scaytid="350">File.Exists</span>("<span data-scayt_word="Output.xls" data-scaytid="352">Output.xls</span>") Then
<span data-scayt_word="File.Delete" data-scaytid="358">File.Delete</span>("<span data-scayt_word="Output.xls" data-scaytid="353">Output.xls</span>")
End If

' Save document
<span data-scayt_word="document.SaveAs" data-scaytid="360">document.SaveAs</span>("<span data-scayt_word="Output.xls" data-scaytid="354">Output.xls</span>")

' Close Spreadsheet
<span data-scayt_word="document.Close" data-scaytid="362">document.Close</span>()

C#:

// Create new Spreadsheet
Spreadsheet document = new Spreadsheet();

// Add new worksheet
Worksheet worksheet = <span data-scayt_word="document.Workbook.Worksheets.Add" data-scaytid="345">document.Workbook.Worksheets.Add</span>("<span data-scayt_word="HelloWorld" data-scaytid="347">HelloWorld</span>");

// Set cell value
<span data-scayt_word="worksheet.Cell" data-scaytid="349">worksheet.Cell</span>(0, 0).Value = "Hello, World!";
// delete output file if exists already
if (<span data-scayt_word="File.Exists" data-scaytid="351">File.Exists</span>("<span data-scayt_word="Output.xls" data-scaytid="355">Output.xls</span>")){
<span data-scayt_word="File.Delete" data-scaytid="359">File.Delete</span>("<span data-scayt_word="Output.xls" data-scaytid="356">Output.xls</span>");
}

// Save document
<span data-scayt_word="document.SaveAs" data-scaytid="361">document.SaveAs</span>("<span data-scayt_word="Output.xls" data-scaytid="357">Output.xls</span>");

// Close Spreadsheet
<span data-scayt_word="document.Close" data-scaytid="363">document.Close</span>();
  • Press F5 to compile and run your first application with Spreadsheet SDK.

The application will generate Output.XLS file in the /bin/ folder

More samples

For more samples on writing, reading, calculating XLS and XLSX spreadsheets explore “ByteScout Samples / Spreadsheet SDK ” folder in “My Documents”.

Evaluation version adds worksheet with text reminder each time you save the spreadsheet file.

Shop Safely: we provide 30-Day Unconditional Money Back Guarantee for the Spreadsheet SDK.

Have a Question?

Contact us at support@bytescout.com or use the online contact form at https://bytescout.com/support/index.php?_m=tickets&_a=submit&step=1&departmentid=2

Thanks again for evaluating Spreadsheet SDK!

Tutorials: