---
Product: Aspose.Cells
Platform: java
Page Type: index
Canonical URL: https://products.aspose.org/cells/java/
---

# Aspose.Cells FOSS for Java

Create, modify, and save Excel XLSX workbooks from Java — free and open-source, zero Microsoft Office dependency.

Aspose.Cells FOSS for Java is a free, MIT-licensed library for creating, reading, modifying, and saving Excel XLSX workbooks. No Microsoft Office required.

## Open-Source Java Library for Excel Spreadsheets

Aspose.Cells FOSS for Java is a free, open-source library for working with Excel workbooks in Java applications. Install it with a single Maven dependency (see below) and start creating workbooks, reading and writing cell values, applying styles, and saving XLSX files, all without requiring Microsoft Excel or any Office dependency. The library exposes a small, familiar object model built around `Workbook`, `Worksheet`, `Cells`, and `Cell`, with supporting classes for styling (`Style`, `Font`, `Borders`), data integrity (`ValidationCollection`, `ConditionalFormattingCollection`), and rich content (`ChartCollection`, `PictureCollection`, `CommentCollection`, `HyperlinkCollection`, `ListObjectCollection`). Workbooks can currently be loaded and saved only in the XLSX format, with `LoadOptions` able to repair malformed packages and XML on load. Aspose.Cells FOSS for Java installs with a single Maven dependency (`org.aspose:aspose-cells-foss:26.7.0`), requires Java 17 or later, and has no runtime dependency on Microsoft Office or native libraries. It is MIT-licensed. Developers requiring enterprise features and production support can use [Aspose.Cells for Java — Enterprise Product](https://products.aspose.com/cells/java/) alongside this open-source library.

## Read and Write Excel Workbooks

- **XLSX round-trip:** Open and save `.xlsx` workbooks with `Workbook` — currently the only supported import/export format.
- **Cell access:** Read and write values through `Cells.get("A1")` or the zero-based `Cells.get(row, column)` overload.
- **Typed values:** `Cell.putValue()` accepts strings, numbers, booleans, and `LocalDateTime`, with the result exposed via `Cell.getType()`.
- **Formulas:** Store formula strings with `Cell.setFormula()` — evaluated by Excel or LibreOffice on open, not by the library at save time.
- **Load diagnostics:** `LoadOptions` can repair malformed packages and XML on load; `Workbook.getLoadDiagnostics()` reports any repairs made.

## Where Aspose.Cells FOSS Can Be Used

- **Data pipelines:** Export database query results directly to XLSX from a Java service.
- **Report generation:** Build styled Excel reports from a Java backend without Office installed.
- **File repair:** Load and re-save malformed XLSX files uploaded by users, using `LoadOptions` repair flags.
- **ETL workflows:** Read input sheets, transform data in Java, and write output workbooks.

## Cell Styling, Validation, and Filtering

- **Full cell styling:** `Style` covers font, borders, fill, alignment, number formats, and locked/formula-hidden protection flags.
- **Conditional formatting:** `ConditionalFormattingCollection` and `FormatCondition` apply rules such as cell-value or expression conditions with their own style and priority.
- **Data validation:** `ValidationCollection` and `Validation` define rules like whole-number, list, or date constraints with configurable alert behavior.
- **AutoFilter:** `AutoFilter.setRange()` plus `FilterColumnCollection` and `AutoFilterSortState` configure filter columns and multi-level sort state.
- **Worksheet protection:** `Worksheet.protect()` / `unprotect()` and `WorksheetProtection` lock down sheet-level editing permissions.

## Where Validation and Formatting Matter

- **Financial models:** Apply conditional formatting to flag out-of-range values automatically.
- **Data entry templates:** Use data validation rules to guard against invalid input before a file is distributed.
- **Filterable deliverables:** Configure an AutoFilter range so recipients can filter the spreadsheet directly in Excel.
- **Locked templates:** Protect a worksheet's structure while leaving specific cells editable.

## Rich Worksheet Content

- **Charts:** `ChartCollection.add()` creates an embedded chart with a type, data range, and position within a worksheet.
- **Comments and hyperlinks:** `CommentCollection` and `HyperlinkCollection` attach cell notes and hyperlinks with custom display text.
- **Pictures:** `PictureCollection.add()` embeds images into a worksheet from byte arrays, streams, or file paths.
- **Excel Tables:** `ListObjectCollection` creates, resizes, and styles structured tables (ListObjects) with column definitions.
- **Page setup:** `PageSetup` configures paper size, orientation, scaling, and print area for a worksheet.

## Developer Experience

Aspose.Cells FOSS for Java installs with a single Maven dependency (see the Quick Start example below). There are no native Office libraries or system packages to install — Java 17+ and Maven 3.9+ are the only build requirements.

The API is intentionally small: `Workbook`, `Worksheet`, `Cells`, `Cell`, and `Style` cover the vast majority of real-world use cases. The codebase is MIT-licensed, hosted on GitHub, and accepts bug reports and pull requests.

## Create a Workbook, Style a Cell, and Save

Install with Maven, then create a `Workbook`, access the first `Worksheet`, write values to cells, and bold a header cell by modifying its style before saving. Row height and column width are set directly on the `Cells` collection.

```xml
<dependency>
  <groupId>org.aspose</groupId>
  <artifactId>aspose-cells-foss</artifactId>
  <version>26.7.0</version>
</dependency>
```

```java
import org.aspose.cells_foss.Cell;
import org.aspose.cells_foss.Style;
import org.aspose.cells_foss.Workbook;
import org.aspose.cells_foss.Worksheet;
import org.aspose.cells_foss.WorksheetCollection;

public class Main {
    public static void main(String[] args) {
        try (Workbook workbook = new Workbook()) {
            WorksheetCollection worksheets = workbook.getWorksheets();
            Worksheet sheet = worksheets.get(0);
            sheet.setName("Report");

            sheet.getCells().get("A1").putValue("Revenue");
            sheet.getCells().get("B1").putValue(12500.75);

            Cell total = sheet.getCells().get("B1");
            Style style = total.getStyle();
            style.getFont().setBold(true);
            style.setCustom("#,##0.00");
            total.setStyle(style);

            sheet.getCells().getRows().get(0).setHeight(22.0);
            sheet.getCells().getColumns().get(1).setWidth(14.5);

            workbook.save("report.xlsx");
        }
    }
}
```

## Load a Workbook with Package Repair

Load an existing XLSX file with `LoadOptions` configured to repair a malformed package or XML on load, inspect any repairs made via `getLoadDiagnostics()`, then update a document property and save.

```java
import org.aspose.cells_foss.LoadIssue;
import org.aspose.cells_foss.LoadOptions;
import org.aspose.cells_foss.Workbook;

public class LoadWorkbook {
    public static void main(String[] args) {
        LoadOptions options = new LoadOptions();
        options.setStrictMode(false);
        options.setTryRepairPackage(true);
        options.setTryRepairXml(true);

        try (Workbook workbook = new Workbook("input.xlsx", options)) {
            if (workbook.getLoadDiagnostics().hasRepairs()) {
                for (LoadIssue issue : workbook.getLoadDiagnostics().getIssues()) {
                    System.out.println(issue.getMessage());
                }
            }

            workbook.getDocumentProperties().setAuthor("cells-foss");
            workbook.save("output.xlsx");
        }
    }
}
```

## Apply Data Validation and Conditional Formatting

Add a whole-number data validation rule to a cell range, then add a conditional-formatting rule that bolds cells whose value falls in a given range.

```java
import org.aspose.cells_foss.CellArea;
import org.aspose.cells_foss.FormatCondition;
import org.aspose.cells_foss.FormatConditionCollection;
import org.aspose.cells_foss.FormatConditionType;
import org.aspose.cells_foss.OperatorType;
import org.aspose.cells_foss.Style;
import org.aspose.cells_foss.Validation;
import org.aspose.cells_foss.ValidationType;
import org.aspose.cells_foss.Workbook;
import org.aspose.cells_foss.Worksheet;
import org.aspose.cells_foss.WorksheetCollection;

public class RulesExample {
    public static void main(String[] args) {
        try (Workbook workbook = new Workbook()) {
            WorksheetCollection worksheets = workbook.getWorksheets();
            Worksheet sheet = worksheets.get(0);

            int validationIndex = sheet.getValidations().add(new CellArea(1, 0, 10, 1));
            Validation validation = sheet.getValidations().get(validationIndex);
            validation.setType(ValidationType.WHOLE_NUMBER);
            validation.setOperator(OperatorType.BETWEEN);
            validation.setFormula1("1");
            validation.setFormula2("100");

            int cfIndex = sheet.getConditionalFormattings().add();
            FormatConditionCollection conditions = sheet.getConditionalFormattings().get(cfIndex);
            conditions.addArea(CellArea.createCellArea("B2", "B11"));
            int conditionIndex = conditions.addCondition(
                    FormatConditionType.CELL_VALUE,
                    OperatorType.BETWEEN,
                    "1",
                    "100");

            FormatCondition condition = conditions.get(conditionIndex);
            Style style = condition.getStyle();
            style.getFont().setBold(true);
            condition.setStyle(style);

            workbook.save("rules.xlsx");
        }
    }
}
```

## Frequently Asked Questions

### What is the licensing model for Aspose.Cells FOSS for Java?

Aspose.Cells FOSS for Java is released under the MIT License. There is no commercial license key, no evaluation watermark, and no feature limiter.

### Can I use it in commercial products?

Yes. The MIT License permits use, modification, and redistribution in personal, open-source, and commercial projects without royalties or attribution requirements beyond preserving the license notice.

### What Java version is required?

Java 17 or later. The library targets the Java 17 LTS runtime and uses try-with-resources (`Workbook` implements the standard Java auto-closeable resource contract) for workbook lifecycle management.

### Are there any native dependencies?

No. `Workbook` creation, loading, and saving are implemented entirely in pure Java — there are no native libraries, no Microsoft Office installation, and no external process dependencies.

### Which formats can be read and written?

Reading and writing is currently limited to the Excel Open XML `.xlsx` format. `LoadFormat` and `SaveFormat` both declare an XLSX value backed by a functional implementation.

### Does the library calculate formulas?

No. The library stores and round-trips formula strings exactly as written (`Cell.getFormula()` / `Cell.setFormula()`), but it does not evaluate or recalculate them. Open the saved file in a spreadsheet application to get calculated values.

## Support and Learning Resources

- [Documentation](https://docs.aspose.org/cells/java/)
- [API References](https://reference.aspose.org/cells/java/)
- [Free Support](https://forum.aspose.org/)
- [Contribution](https://contribution.aspose.org/)
- [Blog](https://blog.aspose.org/)
- [New Releases](https://releases.aspose.org/)