---
Product: Aspose.PDF
Platform: java
Page Type: kb
Canonical URL: https://kb.aspose.org/pdf/java/how-to-convert-pdf-to-excel-java
---

# How to Convert a PDF to an Editable Excel Workbook in Java

Convert a PDF to an editable XLSX workbook, tune the export for cleaner spreadsheets, and convert an XLSX workbook back to PDF using Aspose.PDF FOSS for Java.

This guide shows how to turn a PDF into a workbook you can actually edit, not just a
flat export. You will convert a PDF to XLSX with `ExcelSaveOptions`, tune the export so
tables land cleanly on a reasonable number of sheets, and convert an edited workbook
back to PDF with `ExcelLoadOptions`.

## Convert a PDF to a Basic Excel Workbook

`Document.save` with `SaveFormat.Xlsx` performs a straightforward conversion: each page's
text and table-like content is placed onto its own worksheet.

```java
import org.aspose.pdf.Document;
import org.aspose.pdf.SaveFormat;

try (Document doc = new Document("report.pdf")) {
    doc.save("report.xlsx", SaveFormat.Xlsx); // SaveFormat.Excel is an alias
}
```

## Tune the Export for Cleaner Spreadsheets

A one-sheet-per-page export is often not what a spreadsheet user wants. `ExcelSaveOptions`
controls worksheet merging, column layout, and table-recovery heuristics for PDFs that have
no tagged table structure:

```java
import org.aspose.pdf.Document;
import org.aspose.pdf.ExcelSaveOptions;

try (Document doc = new Document("report.pdf")) {
    ExcelSaveOptions options = new ExcelSaveOptions();
    options.setFormat(ExcelSaveOptions.ExcelFormat.XLSX); // default
    options.setMinimizeTheNumberOfWorksheets(true);        // merge pages onto fewer sheets
    options.setInsertBlankColumnAtFirst(false);            // no leading spacer column
    options.setUniformWorksheets(false);                   // allow per-sheet column widths
    options.setStructuralHeuristics(true);                 // recover tables on untagged PDFs
    options.setSuppressRunningHeadersFooters(true);         // drop repeated page furniture
    doc.save("report.xlsx", options);
}
```

`setMinimizeTheNumberOfWorksheets(true)` is the single option that most changes the
output shape: without it, a 20-page report produces 20 worksheets.

## Convert an Excel Workbook Back to PDF

After a reviewer edits the workbook, bring it back into PDF form by loading it with
`ExcelLoadOptions` and saving the resulting document:

```java
import org.aspose.pdf.Document;
import org.aspose.pdf.ExcelLoadOptions;

try (Document doc = new Document("book.xlsx", new ExcelLoadOptions())) {
    doc.save("book.pdf");
}
```

## See Also

- [Convert PDF to Excel and Markdown](https://docs.aspose.org/pdf/java/developer-guide/conversion/)
- [How to Work with Interactive Forms in Java](https://kb.aspose.org/pdf/java/how-to-work-with-forms-java/)
- [Use Cases for Aspose.PDF FOSS for Java](https://kb.aspose.org/pdf/java/use-cases/)
- [Aspose.PDF for Java — Enterprise Knowledge Base](https://kb.aspose.com/pdf/java/)