# Save and Export Excel XLSX Files

Learn how to programmatically save and export Excel XLSX files in C# .NET. Get started and see more from Document Solutions today.

## Content

This tutorial shows how to programmatically export newly generated or modified XLSX workbooks from server-side .NET applications using C# and the **Document Solutions for Excel .NET (DsExcel .NET)** API. You’ll learn how to create a minimal workbook in memory and save it as a standard **.<span data-highlighted="true" data-vc="highlighted-text">xlsx</span>** file using the **[Workbook.save()](https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html "https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html")**[ method](https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html "https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html").

## Prerequisites

Before you begin, make sure you have:

* **.NET SDK**
* **Document Solutions for Excel .NET (DsExcel .NET)**
* The **[DS.Documents.Excel](https://www.nuget.org/packages/DS.Documents.Excel)**[ NuGet package](https://www.nuget.org/packages/DS.Documents.Excel) installed in your project

Install the package using the NuGet Package Manager or the .NET CLI:

```bash
dotnet add package DS.Documents.Excel
```

Add the required namespace as a using statement:

```csharp
using GrapeCity.Documents.Excel;
```

## 1) Create a Minimal Excel Workbook in .NET

Start by creating a new Workbook object and getting the first worksheet:

```csharp
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.Worksheets[0];
worksheet.Name = "Sheet1";
```

## 2) Save the Workbook as an <span data-highlighted="true" data-vc="highlighted-text">XLSX</span> File

To export the workbook, call the **[save()](https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html "https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html")**[ method](https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html "https://developer.mescius.com/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IWorkbook.Save.html") from your workbook object with a file name or full path.

### Save to the current working directory

```csharp
workbook.Save("output.xlsx");
```

You can also explicitly specify the <span data-highlighted="true" data-vc="highlighted-text">XLSX</span> file format:

```csharp
workbook.Save("output.xlsx", SaveFileFormat.Xlsx);
```

### Save to an absolute file path (Windows)

Be sure to replace temp with the file path where you want to save the file.

```csharp
workbook.Save(@"C:\temp\output.xlsx", SaveFileFormat.Xlsx);
```

### Save to an absolute file path (Linux/macOS)

```csharp
workbook.Save("/tmp/output.xlsx", SaveFileFormat.Xlsx);
```

## Notes for Server-Side Usage

DsExcel .NET is designed to run **server-side** and does **not** require Microsoft Excel or Office Interop.
Common server-side usage patterns include:

* Generating Excel reports in a .NET Web API
* Updating uploaded **.<span data-highlighted="true" data-vc="highlighted-text">xlsx</span>** templates and exporting a final workbook
* Creating scheduled Excel exports in background services
* Running Excel generation workflows in cross-platform .NET applications

## Next Steps

* Read the [full saving a workbook documentation here](https://developer.mescius.com/document-solutions/dot-net-excel-api/docs/online/Features/ManageWorkbook/open-and-save-workbook#save-a-workbook "https://developer.mescius.com/document-solutions/dot-net-excel-api").
* Explore a [full demo showcasing saving to an Excel file here](https://developer.mescius.com/document-solutions/dot-net-excel-api/demos/saveworkbooktoexcelfile "https://developer.mescius.com/document-solutions/dot-net-excel-api/demos/").