Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created September 5, 2026 11:05
Show Gist options
  • Select an option

  • Save aspose-com-gists/f087b04c03b9e45aff47ef3e37d8b940 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/f087b04c03b9e45aff47ef3e37d8b940 to your computer and use it in GitHub Desktop.
Create MS Excel Spreadsheets Without MS Office in C#
using System;
using Aspose.Cells;
namespace AsposeCellsExample
{
class Program
{
static void Main(string[] args)
{
// Create a new workbook instance (default format is Xlsx)
Workbook workbook = new Workbook();
// Add a new worksheet with a custom name to the workbook
// The Add method returns the created Worksheet object
Worksheet newSheet = workbook.Worksheets.Add("MyWorksheet");
// Optionally, put some data into the new worksheet
newSheet.Cells["A1"].PutValue("Hello, Aspose.Cells!");
// Save the workbook to a file in the current directory
// SaveFormat.Xlsx specifies the output file type
workbook.Save("MyWorkbook.xlsx", SaveFormat.Xlsx);
Console.WriteLine("Workbook created and saved successfully.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment