
Perform PDF to Excel conversion online.
PDF files are widely used for sharing and storing important documents, but extracting structured data from them can be challenging. Therefore, the conversion of PDF to Excel using a Java REST API automates the process, ensuring accurate data extraction while preserving formatting and structure. This approach eliminates the need for manual data entry, reduces errors, and saves time, making it ideal for financial reports, invoices, and large datasets.
- PDF to Excel Conversion REST API
- PDF to XLS Conversion in Java
- Online PDF to XLSX Conversion using cURL Commands
PDF to Excel Conversion REST API
GroupDocs.Conversion Cloud SDK for Java provides an efficient and reliable solution for converting PDF files into Excel workbooks. Some of the salient features the REST API offers:
- High-Quality PDF to Excel Conversion – Preserves tables, layouts, and data accuracy.
- Batch Processing – Convert multiple PDFs to Excel files in a single operation.
- Custom Conversion Settings – Define specific sheets, delimiters, and formatting options.
- Cloud-Based Processing – Eliminates the need for local installations and enhances scalability.
- Secure API Integration – Ensures data privacy with authentication and encrypted communication.
Installation
Please add the following details to pom.xml file of maven build project.
<repository>
<id>repository.groupdocs.cloud</id>
<name>repository.groupdocs.cloud</name>
<url>https://releases.groupdocs.cloud/java/repo/</url>
</repository>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-conversion-cloud</artifactId>
<version>24.8</version>
</dependency>
After the installation, please obtain your personalized API credentials(i.e. Client ID and Client Secret). You may visit this short tutorial explaining the details on how to get the API credentials.
PDF to XLS Conversion in Java
Let’s explore the details on how we can seamlessly integrate PDF to Excel conversion into our Java applications, enabling efficient data extraction and processing.
- Firstly, create an instance of
Configuration
class where we pass client credentials as arguments.
Configuration configuration = new Configuration(clientId, clientSecret);
- Secondly, initialize the
ConvertApi
where we pass Configuration object as an argument.
ConvertApi convertApi = new ConvertApi(configuration);
- Create an instance of
ConvertSettings
class where we define the input file name, output format as XLS and the name of resultant document.
ConvertSettings settings = new ConvertSettings();
- Create an instance of
ConvertDocumentRequest
class where we passConvertSettings
object as an argument.
ConvertDocumentRequest request = new ConvertDocumentRequest(settings);
- Lastly, call the ConvertDocumentRequest API to convert PDF to Excel workbook and then save the resultant XLS to the cloud storage.
List<StoredConvertedResult> response = convertApi.convertDocument(request);
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet | |
// Obtain your API credentials | |
string clientId = "XXXXXX-XXXXXXXXX-4088-9ca0-55c38f4b7f22"; | |
string clientSecret1 = "XXXXXXXXXXXXXXXXXXXX"; | |
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret | |
Configuration configuration = new Configuration(clientId, clientSecret); | |
// Define the API base URL for PDF to Excel conversion operation | |
configuration.setApiBaseUrl("https://api.groupdocs.cloud"); | |
// Initialize an instance of ConvertApi with the Configuration object | |
ConvertApi convertApi = new ConvertApi(configuration); | |
ConvertSettings settings = new ConvertSettings(); | |
settings.setStorageName("internal"); | |
settings.setFilePath("marketing.pdf"); | |
settings.setFormat("xls"); | |
settings.setOutputPath("myResultant.xls"); | |
// Invoke the ConvertDocument API for PDF to XLS format conversion | |
ConvertDocumentRequest request = new ConvertDocumentRequest(settings); | |
List<StoredConvertedResult> response = convertApi.convertDocument(request); | |
// Check the response and print success message | |
if (response != null && response.equals("OK")) { | |
System.out.println("The PDF to Excel conversion completed successfully!"); | |
} |
Image:- Preview of PDF to Excel workbook conversion.
The input PDF file marketing.pdf and the resultant Excel workbook generated through above code snippet can be downloaded from myResultant.xls.
Online PDF to XLSX Conversion using cURL Commands
GroupDocs.Conversion Cloud API allows seamless conversion of PDF files to Excel (XLSX) format using simple cURL commands. This approach is ideal for developers who prefer command-line interactions or need to automate the conversion process without integrating a full-fledged SDK.
Firstly, we need to generate a JWT access token based on client credentials and then execute the following command to perform MPP to HTML conversion.
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{ \"StorageName\": \"default\", \"FilePath\": \"{sourceMPP}\", \"Format\": \"xlsx\", \"OutputPath\": \"{convertedFile}\"}"
Please replace sourceMPP
with the name of input MS Project file, convertedFile
with the name of resultant HTML file and accessToken
with a personalized JWT access token.
- If we have a requirement to save the resultant XLSX to local drive, please try executing the following cURL command:
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{ \"StorageName\": \"default\", \"FilePath\": \"{sourceFile}\", \"Format\": \"xlsx\"}" \
-o "resultant.xlsx"
PDF to Excel Online
You may also consider experiencing the amazing capabilities of document conversion API by using our free and lightweight PDF to XLSX Online Converter App. This App is built on top of GroupDocs.Conversion Cloud REST API and enables you to explore the unique capabilities within a web browser.
Useful Links
Conclusion
Whether you are processing financial reports, data tables, or structured business documents, our REST API ensures high accuracy and seamless integration into your applications. With support for cURL commands and Java SDK, you can automate conversions effortlessly while preserving data integrity. Try GroupDocs.Conversion Cloud today and streamline your document conversion needs with a powerful, scalable, and reliable solution.
Recommended Articles
We highly recommend visiting the following links to learn more about: