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 alongside this open-source library..xlsx workbooks with Workbook — currently the only supported import/export format.Cells.get("A1") or the zero-based Cells.get(row, column) overload.Cell.putValue() accepts strings, numbers, booleans, and LocalDateTime, with the result exposed via Cell.getType().Cell.setFormula() — evaluated by Excel or LibreOffice on open, not by the library at save time.LoadOptions can repair malformed packages and XML on load; Workbook.getLoadDiagnostics() reports any repairs made.LoadOptions repair flags.Style covers font, borders, fill, alignment, number formats, and locked/formula-hidden protection flags.ConditionalFormattingCollection and FormatCondition apply rules such as cell-value or expression conditions with their own style and priority.ValidationCollection and Validation define rules like whole-number, list, or date constraints with configurable alert behavior.AutoFilter.setRange() plus FilterColumnCollection and AutoFilterSortState configure filter columns and multi-level sort state.Worksheet.protect() / unprotect() and WorksheetProtection lock down sheet-level editing permissions.ChartCollection.add() creates an embedded chart with a type, data range, and position within a worksheet.CommentCollection and HyperlinkCollection attach cell notes and hyperlinks with custom display text.PictureCollection.add() embeds images into a worksheet from byte arrays, streams, or file paths.ListObjectCollection creates, resizes, and styles structured tables (ListObjects) with column definitions.PageSetup configures paper size, orientation, scaling, and print area for a worksheet.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.
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.
<dependency>
<groupId>org.aspose</groupId>
<artifactId>aspose-cells-foss</artifactId>
<version>26.7.0</version>
</dependency>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 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.
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");
}
}
}
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.
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");
}
}
}
Aspose.Cells FOSS for Java is released under the MIT License. There is no commercial license key, no evaluation watermark, and no feature limiter.
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.
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.
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.
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.
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.