IRONSOFTWAREHOME

.NET Code Samples

C# VB PDF .NET : Create a new Excel File in .NETCreate a new Excel File in .NET
using IronXL;

// Create new Excel WorkBook document
WorkBook workBook = WorkBook.Create();

// Convert XLSX to XLS
WorkBook xlsWorkBook = WorkBook.Create(ExcelFileFormat.XLS);

// Create a blank WorkSheet
WorkSheet workSheet = workBook.CreateWorkSheet("new_sheet");

// Add data and styles to the new worksheet
workSheet["A1"].Value = "Hello World";
workSheet["A1"].Style.WrapText = true;
workSheet["A2"].BoolValue = true;
workSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;

// Save the excel file as XLS, XLSX, CSV, TSV, JSON, XML, HTML and streams
workBook.SaveAs("sample.xlsx");
NuGet Downloads Badge
PM > Install-Package IronXL.Excel

The Create Excel feature provides developers with a powerful way to generate and manage Excel files directly within .NET applications.

It streamlines tasks like creating new workbooks, adding worksheets, and inputting data while offering advanced styling options such as text wrapping, borders, and formatting. This feature is perfect for automating reports, exporting data, or creating dynamic spreadsheets. IronXL supports multiple file formats, including XLS, XLSX, CSV, and more, ensuring compatibility with various systems. With its user-friendly API, developers can focus on core functionality while saving time and reducing complexity in Excel file management.

The WorkBook object serves as the foundation of any Excel file. By initializing a new workbook, developers gain access to a blank Excel document, ready to be populated with data and formatted as needed.

Every Excel workbook requires at least one worksheet. The next step demonstrates how to create a new sheet within the workbook and assign it a custom name. Worksheets act as the primary structure for organizing data in rows and columns.

The snippet demonstrates how to add content by assigning the value "Hello World" to a specific cell, A1. This shows how easy it is to populate data into an Excel sheet programmatically, enabling developers to automate tasks like report generation and data export.

Additionally, the snippet applies styling to the cell by enabling the WrapText property. This ensures that lengthy content in the cell is displayed neatly across multiple lines, improving readability and preventing text from being cut off. Such styling options empower developers to create visually appealing and professional spreadsheets.

Explore the Step-by-Step Guide to Create Excel Files in C#

Support From Our .NET Team

Iron .NET Excel product development team is on hand to support all of your questions. Get in touch with questions on our library.

Our engineer team has over 10 years of experience dealing with .NET software. You will find our software being used by thousands of reputable SMEs, developers, governments, and more. Our experience has also allowed us to develop a helpful customer support model with resources you can trust. Our team works to ensure your software is running smoothly and makes sense for your business.

.NET Library Capabilities

Our .NET Excell Install can facilitate creating a new Excel file in .NET, read Excel files without any Microsoft Interop, working with various Excel worksheets and ranges, converting spreadsheet file types into what you need, (i.e. XLS/XLSX/CSV/TSV/JSON) and Excel to SQL connections via System.Data.DataSet and DataGrid via DataTable.

Some of our key net excel library features include recalculating excel formulas each time a sheet is edited, sorting capabilities for ranges, columns, and rows, and stylizing items such as fonts, size, background patterns, alignments, etc.

Essentially, you get all the Excel functionality without any of the Microsoft Interop. You also have more customizable options that can give your spreadsheets a more polished look. The possibilities are endless with the NuGet download of our .NET library. 

Read & Write Spreadsheet Formats in .NET

IronXL allows you to read & write Excel Spreadsheets in your .NET APPs. Read & Edit XLS/XLSX/CSV/TSV - Save & Export to XLS/XLSX/CSV/TSV/JSON.

SQL Supported

Transfer Data between Excel, SQL and GridViews using System.Data.DataSet and System.Data.DataTable objects.

Edit Excel Formulas

Supports Microsoft Excel formulas. Easy to use WorkSheet [“A1:B10”] syntax. Combine and set ranges intuitively. Sort by Ranges, Columns and Rows.

Style Excel Spreadsheets

Set Font, Size, Background, Border, Alignment and format.
Visual Studio - C# Create Excel Spreadsheet .NET Library - for Excel document Creation and Editing.

.NET Projects made with Visual Studio

The IronXL integration platform is helpful for a number of different industries and functions. You will find applicability with accounting and finance systems, business digitization, enterprise content management, and data/reporting fields.

IronXL puts Excel tools in your projects easily with Visual Studio .NET installer.
You can download the software product from this link.

Supports:

  • .NET Core 2.0 and above
  • .NET Framework 4.0 and above support C#, VB, F#
  • Microsoft Visual Studio. .NET Development IDE Icon
  • NuGet Installer Support for Visual Studio
  • JetBrains ReSharper C# language assistant compatible
  • Microsoft Azure C# .NET  hosting platform compatible

.NET Licensing & Pricing

Free community development licenses. Commercial licenses from $999.

View Full License Options

Excel Spreadsheet Tutorials for .NET

How to Create Excel Files in .NET
C#ExcelASP.NET
Jonas Schmidt - C# Developer

How to Create Excel Files in C#

See How Jonas uses IronXL to generate Excel Files without using Office Interop...

View Jonas' Excel File Generation Tutorial
Reading and Writing Excel Tutorial + Code Examples in C# & VB.NET
C#ExcelXLSX
Elijah Williams - Product Development Engineer

Open and Edit Excel Files in C# or VB.NET

Elijah shares a no-nonsense approach to reading Excel data into C# Applications...

See Elijah's Excel Reading & Editing Tutorial
Tutorial + Code Examples VB.NET PDF Creation and Editing | VB.NET & ASP.NET PDF
C#ExcelData
Rebecca White - .NET Solution Director

How to Read Excel Files into .NET Apps.

Rebecca's code walkthrough for reading Excel data into a .NET application...

Read Becky's C# Tutorial

.NET Coders use IronXL for...

Accounting and Finance Systems

  • # Receipts
  • # Reporting
  • # Invoice Printing
Add Excel Support to ASP.NET Accounting and Finance Systems

Business Digitization

  • # Documentation
  • # Ordering & Labelling
  • # Paper Replacement
C# Business Digitization Use Cases

Enterprise Content Management

  • # Content Production
  • # Document Management
  • # Content Distribution
.NET CMS Excel Support

Data and Reporting Applications

  • # Performance Tracking
  • # Trend Mapping
  • # Reports
C# Excel Reports
Join Them Today
Iron Software Enterprise .NET Component Developers
C# Library Developers

Thousands of corporations, governments, SMEs and developers alike trust Iron software products.

Iron's team have over 10 years experience in the .NET software component market.

Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required