# Saving and Export Excel XLSX Files Using Java

Learn how to programmatically save and export .xlsx files in Java applications. Get started and see more from Document Solutions today.

## Content

This tutorial shows how to persist generated or modified Excel workbooks using **Document Solutions for Excel, Java Edition (DsExcel Java)**. You’ll learn how to create a minimal workbook in memory and save it as a standard **.xlsx** file using the [Workbook.save() method](https://developer.mescius.com/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/Workbook.html#save).

***

## Prerequisites

Before you begin, make sure you have:

* **JDK 8 or later**
* **Document Solutions for Excel, Java Edition (DsExcel Java)**
* The DsExcel **JARs added to your classpath**

Import the required namespaces:

```auto
import com.grapecity.documents.excel.*;
```

***

## 1) Create a Minimal Excel Workbook in Java

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

```auto
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.getWorksheets().get(0);
worksheet.setName("Sheet1");
```

(Optional) Add a little data so you can verify output:

```auto
worksheet.getRange("A1").setValue("Hello from DsExcel Java!");
worksheet.getRange("A2").setValue(12345);
```

***

## 2) Save the Workbook as an XLSX File

To export the workbook, call Workbook.save() from your workbook object with a file name or full path.

### Save to the current working directory

```auto
workbook.save("output.xlsx");
```

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

Be sure to replace "temp" with the file path to where you are trying to save the file.

```auto
workbook.save("C:\\temp\\output.xlsx");
```

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

```auto
workbook.save("/tmp/output.xlsx");
```

***

## Notes for Server-Side Usage

DsExcel Java 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 REST API
* Updating uploaded .xlsx templates and exporting a final version
* Running automated scheduled exports on Linux servers

***

## Next Steps

* Read the [full documentation page here](https://developer.mescius.com/document-solutions/java-excel-api/docs/online/Features/ManageWorkbook/OpenSaveProtectWorkbook#save-a-workbook).
* Explore a [full demo showcasing this feature here](https://developer.mescius.com/document-solutions/java-excel-api/demos/saveworkbooktoexcelfile).