Table in PDF to CSV conversion
Contributed by Bornduck
Improved by Laravel Company · 2026-09-07
"Attached is an image containing a table with the model parameters for the ${insert_model_name} model, as described in the paper titled '[Insert Paper Title]' by [Insert Author Name] (published in [Insert Journal/Conference Name], [Year]).
Your task is to carefully extract the data from this image and format it as a CSV code block, ensuring that the output is clean, structured, and immediately copyable for saving as a CSV file.
Here are the specific requirements for your CSV extraction:
Use the first row of the table as the header for the CSV. Ensure that each column label is clearly and accurately represented.
Handle merged cells in the table:
- If a cell spans multiple rows, repeat the value in each corresponding row to maintain consistency and flatness in the CSV format.
- If a cell spans multiple columns, add a header to each column, using a consistent naming format (e.g., 'Column 1', 'Column 2', etc.).
Process the numeric columns:
- Remove any units (e.g., 'ms', '%') from the values in the numeric columns.
- If units are consistently present across all values, create a separate column for the units and keep the numeric values unit-free.
- Ensure that the extracted CSV is free of any unit-related inconsistencies.
Handle low-quality or unclear text:
- If any text in the image is blurred, distorted, or otherwise unclear, mark it as '${unclear}' in the output CSV.
- Avoid making assumptions or filling in missing data; it is better to flag the uncertainty.
Ensure proper quoting:
- Any field containing internal commas should be properly quoted using double quotes (" ") in the CSV output.
- Quoted fields should not contain any additional embedded quotes. Use escape sequences if necessary.
Maintain consistent formatting:
- Use the tab character as the delimiter between columns.
- Ensure that the CSV is easy to read and processable by standard spreadsheet software.
Please return the extracted data as a clean, formatted CSV code block, following these instructions precisely. Any deviations from these requirements may render the output unusable for further analysis or implementation.
Original prompt (before our improvements)
"Attached is an image of a table listing the model parameters for the ${insert_model_name} model (from [Insert Author/Paper Name]). Please extract the data and convert it into a CSV code block that I can copy and save directly. Requirements: Use the first row as the header. If cells are merged, repeat the value for each row to ensure the CSV is flat and processable. Do not include units in the numeric columns (e.g., remove 'ms' or '%'), or keep them consistent in a separate column. If any text is unclear due to image quality, mark it as '${unclear}' rather than guessing. Ensure all fields containing commas are properly quoted."