How to Create New Spreadsheets
XLSX is a modern file format for storing Microsoft Excel spreadsheets. It uses the Open XML standard, introduced in Office 2007. XLSX supports advanced features like charts and conditional formatting and is widely used for data analysis and business tasks.
XLS is the older binary format for Excel files used in earlier versions. It lacks the features of XLSX and is now less common.
IronXL offers the capability to create both XLSX and XLS files with just a single line of code.
How to Create New Spreadsheets
- Download the C# library for creating spreadsheets
- Use the static
Create
method to create a spreadsheet - choose whether to create an XLSX or XLS file
- Export the workbook and check the Excel file
- Use the CreatingOptions class to configure the workbook creation
Get started with IronXL
Start using IronXL in your project today with a free trial.
Create Spreadsheet Example
Use the static method Create
to create an Excel workbook that can be used to store a collection of sheets or worksheets. By default, this method will create an Excel workbook in XLSX format.
:path=/static-assets/excel/content-code-examples/how-to/create-spreadsheet-create-spreadsheet.cs
using IronXL;
// Create spreadsheet
WorkBook workBook = WorkBook.Create();
Imports IronXL
' Create spreadsheet
Private workBook As WorkBook = WorkBook.Create()
Choose Spreadsheet Type
The Create
method also accepts an ExcelFileFormat enum that you can use to specify whether you want to create an XLSX or XLS file. Both file formats are for storing Microsoft Excel spreadsheets, with XLSX being the modern, XML-based format introduced in Office 2007, while XLS is the older binary format used in earlier versions. XLS is now less common due to its limited features and lower efficiency compared to XLSX.
:path=/static-assets/excel/content-code-examples/how-to/create-spreadsheet-spreadsheet-type.cs
using IronXL;
// Create XLSX spreadsheet
WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
Imports IronXL
' Create XLSX spreadsheet
Private workBook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)
There is another overload for the Create
method, which takes CreatingOptions as a parameter. However, the CreatingOptions class currently has only one property, DefaultFileFormat, which is used to configure whether to create an XLSX or XLS file. Check the code below for reference:
:path=/static-assets/excel/content-code-examples/how-to/create-spreadsheet-spreadsheet-type.cs
using IronXL;
// Create XLSX spreadsheet
WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
Imports IronXL
' Create XLSX spreadsheet
Private workBook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)