How to Create New Spreadsheets

by Chaknith Bin

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.


C# NuGet Library for Excel

Install with NuGet

Install-Package IronXL.Excel
or
C# Excel DLL

Download DLL

Download DLL

Manually install into your project

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()
VB   C#

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)
VB   C#

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)
VB   C#

Chaknith Bin

Software Engineer

Chaknith is the Sherlock Holmes of developers. It first occurred to him he might have a future in software engineering, when he was doing code challenges for fun. His focus is on IronXL and IronBarcode, but he takes pride in helping customers with every product. Chaknith leverages his knowledge from talking directly with customers, to help further improve the products themselves. His anecdotal feedback goes beyond Jira tickets and supports product development, documentation and marketing, to improve customer’s overall experience.When he isn’t in the office, he can be found learning about machine learning, coding and hiking.