Read this article if you are looking for an accurate, high‑speed, and high‑quality conversion of PDF files to Excel sheets in Java.

{{< figure align=center src=“images/PDF-to-Excel.jpg” alt=“PDF to Excel Java”>}}

There could be various scenarios when you need to export the data within the tables from PDF to Excel workbooks. PDF to Excel lets you edit the data, apply formulas, plot charts, and perform other operations that are supported by the spreadsheets. In this article, I’ll show you how to automate the PDF to Excel conversion and convert PDF to Excel XLS to XLSX programmatically in Java.

Java PDF to Excel Converter - Installation

To convert PDF files to Excel sheets, we will use Aspose.PDF for Java. The library provides a free, powerful, and high‑fidelity PDF to Excel converter. It is available for download as a JAR file. In addition, you can install it in your Maven‑based applications using the following configurations.

Repository:

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>

Dependency:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-pdf</artifactId>
    <version>22.12</version>
    <classifier>jdk17</classifier>
</dependency>

Convert PDF to Excel XLS in Java

To convert PDF to Excel XLS, you simply need to load the PDF document and save it with .xls extension. Follow these steps:

The code sample below demonstrates how to convert PDF to Excel XLS using Java.

{{< gist aspose-com-gists 54bc1b3bf672553e34f2b7a317cffb6c “convert-pdf-to-xls.java” >}}

Input PDF Document

{{< figure align=center src=“images/Convert-pdf-to-excel-C.png” alt=“Convert PDF to Excel”>}}

Output Excel Spreadsheet

{{< figure align=center src=“images/Convert-pdf-to-excel-C-2.png” alt=“PDF to XLS XLSX”>}}

Java PDF to Excel XLSX

For converting PDF to an XLSX spreadsheet, define the output format with the ExcelSaveOptions class. Follow these steps:

The code sample below shows how to convert PDF to XLSX using Java.

{{< gist aspose-com-gists 54bc1b3bf672553e34f2b7a317cffb6c “convert-pdf-to-xlsx.java” >}}

Minimize the Number of Worksheets in PDF to Excel

By default, Aspose.PDF creates a separate worksheet for each PDF page. You can customize the API to reduce the number of worksheets for large PDFs. Follow these steps:

The code sample below demonstrates how to convert PDF to XLSX with a minimized worksheet count using Java.

{{< gist aspose-com-gists 54bc1b3bf672553e34f2b7a317cffb6c “convert-pdf-to-xlsx-minimized-sheets.java” >}}

Free PDF to Excel Java Converter

You can get a free temporary license to convert PDF files to Excel format without evaluation limitations.

Explore PDF to Excel Conversion Library

If you want to explore additional features of Aspose.PDF for Java, visit the documentation here.

Conclusion

In this article, you have learned how to convert PDF to Excel XLS or XLSX files using Java. The guide also covers how to minimize the number of worksheets in the resulting Excel workbook.

See Also