Skip to content
ComPDF

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.

Set the Content Options for Excel

When converting PDF files to Excel files, the following options directly affect content written to the Excel file.

  • excel_all_content: whether the converted XLSX file contains all content in the PDF.
  • excel_csv_format: whether to save table data in CSV format.
  • excel_worksheet_option: worksheet layout option.
OptionDescription
ExcelWorksheetOption::FOR_TABLECreate one sheet per table.
ExcelWorksheetOption::FOR_PAGECreate one sheet per page.
ExcelWorksheetOption::FOR_DOCUMENTCreate one sheet for the entire document.

Sample

ruby
options = ComPDFKitConversion::ConvertOptions.new
options.excel_worksheet_option = ComPDFKitConversion::ExcelWorksheetOption::FOR_TABLE

result = ComPDFKitConversion::Conversion.start_pdf_to_excel(
  input_file_path,
  "",
  output_file_path,
  options
)