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.
| Option | Description |
|---|---|
ExcelWorksheetOption::FOR_TABLE | Create one sheet per table. |
ExcelWorksheetOption::FOR_PAGE | Create one sheet per page. |
ExcelWorksheetOption::FOR_DOCUMENT | Create 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
)