Convert PDF to XLSX using PHP

High-speed, powerful, and secure API for converting PDF documents to XLSX spreadsheets in PHP

PDF XLSX

PDF to XLSX API allows you to convert either scanned or textual PDF documents that contain tabular data to editable MS Office Excel XLSX spreadsheets.

Convert PDF to XLSX programmatically

ConvertAPI provides a spectacular tool that creates editable XLSX spreadsheets from static PDF files. It is available as a REST API service; however, there is a PHP library for simple integration into your project without the need to write explicit HTTP calls to our service. Our library is accessible via composer, and the source code can be found on GitHub. Simply sign up for a free account, retrieve your API secret key, install our PHP library, and you are ready to convert!

Add ConvertAPI to your PHP project

The simplest way to install our library is to use the Composer. Simply execute this command in your project's root directory:

composer require convertapi/convertapi-php

If you want to install it manually, you must require ConvertApi autoloader:

require_once('/path/to/convertapi-php/src/ConvertApi/autoload.php');

Please note that if you do not use the Composer, you need to install the following dependencies for our library:

Convert PDF to XLSX using PHP

Once you have installed our library, you can use the following code snippet showing how to convert PDF to XLSX using the PHP programming language:

<?php
require __DIR__ . '/../lib/ConvertApi/autoload.php';

use \ConvertApi\ConvertApi;

# Code snippet is using the ConvertAPI PHP Client: https://github.com/ConvertAPI/convertapi-php
# Read more about PDF to XLSX API: https://www.convertapi.com/pdf-to-xlsx

ConvertApi::setApiSecret('your-api-secret');
$result = ConvertApi::convert('xlsx', [
        'File' => '/path/to/my_file.pdf',
    ], 'pdf'
);
$result->saveFiles('/path/to/result/dir');

Simple as that! Using the ConvertAPI library for PHP, you can implement a PDF to XLSX conversion with no effort at all. It allows you to convert local files, documents hosted on a server accessible via a public URL, or files uploaded to our server accessible by FileId.

Advanced techniques

Converting a PDF (Portable Document Format) file to XLSX (Microsoft Excel) format is useful when you need to extract tabular data from a PDF document for further analysis, manipulation, or reporting in a spreadsheet. In this article, we covered everything you need to convert a PDF to XLSX using PHP. You can find all conversion parameters on our live demo page. Advanced file conversion techniques and examples can be found in our GitHub examples folder. Let us know if you need any help integrating it into your project!