Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Convert PDF to Excel

Overview

ComPDF Conversion SDK supports converting PDF documents to Microsoft Excel format (.xlsx). By extracting, parsing, and importing data from PDF into Excel, users can further edit, analyze, or share Excel files. This feature helps increase productivity, reduce manual entry errors, and simplify complex document processing tasks.

Set the content options for Excel

When converting PDF files to Excel files, you need to pay attention to the settings of the following options, which will directly affect the content written to the Excel file.

  • Content options:

    If you set the excelAllContent option, the converted XLSX file will contain all the contents in the PDF.

  • Worksheet options:

OptionDescription
ExcelWorksheetOption::FOR_TABLECreate one sheet for one table.
ExcelWorksheetOption::FOR_PAGECreate one sheet for one PDF page.
ExcelWorksheetOption::FOR_DOCUMENTCreate one sheet for the entire PDF document.

Sample

This sample demonstrates how to convert from a PDF to XLSX file.

php
use ComPDFKit\Conversion\ExcelWorksheetOption;

$option = new ConvertOption();
Conversion::convert('Excel', 'excel.pdf', 'password', 'output.xlsx', $option);

// Set all content options.
$option->excelAllContent = true;
$option->excelWorksheetOption = ExcelWorksheetOption::FOR_DOCUMENT;
Conversion::convert('Excel', 'excel.pdf', 'password', 'output_all.xlsx', $option);