Guide
Turn an invoice PDF into Excel or CSV
The left card on TableJSON gives you every table as JSON. The right card is narrower on purpose. It expects a text-layer invoice, maps the line items, checks the arithmetic, and downloads an .xlsx file. CSV is one save away from that workbook. There is no separate CSV endpoint, and inventing one would hide the checksum that makes the workbook worth opening.
Use the right card when the PDF is a bill: a seller, an invoice number, lines with a quantity and a price, and a total. Press Try sample PDF if you want to see the shape first. That loads sample-invoice.pdf. Preview draws the pages in the browser, up to the first twenty, so you can confirm you grabbed the right file. Extract sends the PDF twice in practice: once for the JSON preview you see on the page, and once for the workbook your browser downloads. Both calls are the same route, POST /v1/invoice-xlsx. The preview adds ?format=json.
What the workbook contains
The Invoice sheet starts with six facts in column A and B: vendor, invoice number, date, currency, stated total, and checksum. Under that, row 7 is the header description, qty, unit_price, amount, line_check. Each line item is a row. A failed line check is painted red. Below the lines you get shipping, other, discount, tax, the stated total again, the expected total, the remainder, and the checksum repeated.
A second sheet, Raw extract, keeps the first page's text lines and the tables the general extractor saw. When the Invoice sheet looks wrong, the raw sheet is where you see whether the header was read as item or as column_1. You do not have to re-upload to inspect that. It is already in the file.
Vendor is taken from a nearby label: "Billed by", "Supplier", "Vendor", or "From". Invoice number looks for "Invoice No", "Invoice #", "Inv #", or "Invoice number". The date looks for "Invoice date" and skips a due date so the payment terms do not overwrite the invoice date. An ISO date stays as YYYY-MM-DD. Currency is detected from USD, EUR, GBP, INR, JPY, KRW, or from £, €, ₹, ¥, ₩, or $. If none of those appear, the checksum says FAIL: currency unknown.
What PASS and FAIL actually mean
Each line check multiplies quantity by unit price and compares it with the line amount. PASS on the line means those agreed in minor units, so a currency with two decimals is compared in cents. The total check adds the line amounts, shipping, other charges, and tax, applies the discount, and compares that with the stated total. The stated total prefers "amount due" or "balance due", then "grand total", then "total", so a subtotal is not mistaken for the amount due when both words are present.
FAIL does not block the download. You still get the workbook, and cell B6 says why. The phrases are specific:
FAIL: no text layer— the PDF parsed but had no text. Usually a scan.FAIL: no line table— there was text, but no table mapped to description, quantity, unit price, and amount.FAIL: currency unknown— no code or symbol was found.FAIL: invoice_number missing— the first page had no invoice-number label.- A remainder line — the rebuilt total and the printed total disagree. The message includes both figures and the difference.
A red checksum is a reason to look, not a broken download. I would rather have the file and a visible FAIL than a green total that dropped a freight line. If the remainder is a few cents, look for a rounding line or a discount that was typed as a positive number in the PDF. If the remainder is the whole tax, the word on that row was probably not "tax", "VAT", "GST", or "sales tax", so it was left in the line items or dropped.
Headers the mapper accepts
Description can be headed description, item, or particulars. Quantity can be qty or quantity. Unit price can be unit price, rate, or price. Amount can be amount, line total, net, or value. The match ignores spaces, underscores, and punctuation, so "Unit Price" and "unit_price" both bind. If any of the four is missing, the sheet still builds, but the lines are not fully mapped and the checksum will not pass cleanly. Renaming a column in the source export to one of those words is faster than arguing with the mapper.
Rows whose description is shipping, freight, delivery, discount, tax, VAT, GST, subtotal, or total are pulled out of the line list and used as addends. That is why a "Shipping" row should not also be counted as a product line. If your shipper names freight "Logistics surcharge", it will sit in the lines and the total check will drift. Either rename it before export or accept the remainder and fix that one cell.
From the API, then to CSV
The direct call matches the button. Omit the format query to download the workbook. ?format=json returns the preview the playground shows: vendor, invoice number, lines, checksum, expected total, remainder.
curl -X POST "https://tablejson.com/v1/invoice-xlsx" \ -H "X-API-Key: YOUR_KEY" \ -F "file=@invoice.pdf" \ -o invoice.xlsx
curl -X POST "https://tablejson.com/v1/invoice-xlsx?format=json" \ -H "X-API-Key: YOUR_KEY" \ -F "file=@invoice.pdf"
Excel and Google Sheets both open the xlsx. To get CSV, use Save As or File, Download, Comma-separated values. Do that from the Invoice sheet if you want one flat table of the lines. The metadata in rows 1 to 6 will occupy the top of the CSV, which is what you want if the vendor has to travel with the lines, and annoying if your importer expects the header on row 1. Delete those six rows first, or copy from row 7 down before you export. Numbers in the sheet are already plain values from the checksum math. The original PDF strings are on the Raw extract sheet if you need the unparsed text.
Zapier has an action for this route, Invoice PDF to Excel. RapidAPI lists it on the same OpenAPI document as the table extract. GET /v1/invoice-example returns a tiny canned checksum so a hub tester can press Run without generating a spreadsheet. It does not read your PDF. For a real bill, POST the file.
Scanned invoices are the hard stop. You will get FAIL: no text layer and an almost empty sheet. Run OCR in a tool that outputs a text-layer PDF, then come back, or type a three-line bill by hand. The scan guide shows the highlight test. If the JSON preview looks shifted before you even open Excel, clean the extract with the notes in cleaning messy table JSON, or fix the PDF export so the four headers are real words.
One habit saves rework: open B6 before you import the CSV anywhere. PASS, file the rows. Anything else, read the remainder, check one line by hand, and only then decide the PDF was the problem or the total on the invoice was.