Write to Excel files using C#
with Bytescout Spreadsheet SDK

Bytescout Spreadsheet SDK is a clean and simple API that allows to read and write Excel files in C# applications. Microsoft Excel is widely used and most business applications should have an ability to read from or write to Excel documents.

You can create an XLS file using C# with this simple code. Copy and paste the following source code to your C# project file.

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

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();

            // Add new worksheet
            Worksheet worksheet = document.Workbook.Worksheets.Add("HelloWorld");

            // Set cell value
            worksheet.Cell(0, 0).Value = "Hello, World!";
            // delete output file if exists already
            if (File.Exists("Output.xls")){
                File.Delete("Output.xls");
            }

            // Save document
            document.SaveAs("Output.xls");

            // Close Spreadsheet
            document.Close();

            // open generated XLS document in default program
            Process.Start("Output.xls");
        }
    }
}

Bytescout Spreadsheet SDK is an easy solution for writing to Excel files using C# without MS Excel installed.

Find all sample source codes for C# in a free trial of Spreadsheet SDK. Download now!

More about Bytescout Spreadsheet SDK benefits