How can i extract data table in pdf formate in n8n. table has lot data

how can i extract data table in pdf formate in n8n. table has lot data.

1 Like

Hey Azizul,

I can help you extract large tables from PDF files in n8n with high accuracy, whether the PDFs are digital or scanned, and structure the data into Excel, Google Sheets, Airtable, or your database.

• Parse PDF tables efficiently
• Handle scanned PDFs with OCR when needed
• Clean and structure extracted data
• Export to your preferred destination
• Automate the entire workflow

Let’s schedule a call to discuss the details further.

Hey Azizul, happy to help! It really depends on what your PDFs look like, so let me ask you a few questions first:

  • Is the table structure the same across all documents, or does it vary from PDF to PDF?
  • Are the PDFs digitally generated or scanned?
  • How many documents or rows are we talking about roughly, and what exactly do you mean by “a lot of data”?
  • How sensitive is the data?

Depending on your answers, there are different approaches. A classic workflow would be:

  1. OCR, extract data
  2. Process data (can be done with a script)
  3. Save data

We can also discuss this: Schedule

n8n has a built in “Extract from PDF” but it on pulls in only plain text and not table structure. This means that it falls apart on anything with any real columns and rows. Here are a couple approaches depending on your PDF:

For a normal PDF with selectable text you can pipe it through a Code node that uses a library like pdf-parse or pdf-table-extractor. You can call out to a dedicated table-extraction API via the HTTP Request node and then parse the returned JSON/CSV.

If it’s scanned and image based: you will need OCR first, something like AWS Textract, Google Document AI or Azure Form Recognizer all have decent table-detection modes and you can call straight from an HTTP Request node. Textract’s “Analyze Document” with TABLES feature type is probably the most reliable.

1 Like

Thanks Loic Lavachy for email. Actually I extracted pdf file but when I send data to sheet it was only one raw. I don’t know why not saving all data from pdf table. Ok i am giving answer: 1. Data table structure will be same. 2. All PDFs digitally created. 3. Pls. check the attach file sample. file will be same. But not lot data at a time. 4. If Pdf file is bangla language then what should to do? I attached another challan sample file for better your understand.

(attachments)

Data.pdf (17.9 KB)
challan.pdf (60.2 KB)

Thanks Sachin Karma for your email. I am glad to know that you can help me. Actually I can extract data from pdf data table file using mistral. But when it save data to sheet then I see only one raw added not all. I don’t know why. I am sending you sample data table pdf file. Pls. check the attached file.
My other question that I have another pdf file in bangla language. I also attached that. If Bangla language file then what I should to do?
Azizul

Welcome @Azizul_Khan!

The single-row issue is almost always because Mistral returns the whole table as one JSON array inside a single item, so Sheets only ever sees item 1. Add a Split Out node (or Code node with return items) right after the Mistral node to split that array field into separate items, one per table row, before it hits Google Sheets. Check the JSON output of the Mistral node directly to confirm the rows are nested under one field like “rows” or “table” first. For the Bangla PDF, Mistral OCR does support non-Latin scripts, but double check the extracted text encoding, if it comes back garbled, try setting the language hint explicitly in the request if that model supports it, otherwise route Bangla docs through Google Document AI instead since its table + language detection is more reliable for non-Latin text.

Thanks you Mr. Jay Nguyen for your email. I am sorry for not understand your valuable advice. Actually I am new on n8n and json. If I get any video then can understand. But if possible you can give me sample with details how can I get all raw data to sheet then can try. I attach the sample file please check.
Azizul.

Hey Azizul,

I’ve taken another look at the PDFs and uploaded an example workflow (JSON) in the attachment that shows one possible approach.

For it to run on your end, you need to:

  • Create the credentials yourself (Google Drive and the LLM, currently Mistral)
  • Specify the path to the folder where the PDFs are stored

You can of course swap out the input, for example switching from Google Drive to a form upload. You can also replace the LLM with a different model. The prerequisite is that the PDFs are digitally generated — for scanned documents, you’d need an OCR step beforehand.

Regarding the Bengali example: the script currently only splits the text line by line and saves it as JSON, which isn’t structured extraction like in the English branch yet. It would need further development depending on how exactly the table is structured there.

Generally speaking about PDFs and data protection: You could run the entire process directly through an LLM, but there’s sensitive data involved here (email and address). Without a data processing agreement (DPA) with an EU provider and an appropriate legal basis, I’d advise against feeding it unchecked into an LLM. Since first and last names can’t be cleanly separated automatically, I only pass these two fields to the LLM, which is still a legal gray area and should be checked on a case-by-case basis.

For fine-tuning, I recommend working on the workflow directly with Claude Code or another LLM. If needed, feel free to contact me personally.

pdf-tin-table-extraction.json (17.3 KB)

If Mistral is already extracting the PDF but Google Sheets gets only one row, the usual issue is that the extraction result is still one n8n item containing a table/array. Google Sheets will append one row per input item, so you need one Code node between Mistral and Sheets that turns the extracted table into many items.

For digitally-created PDFs with the same structure, I’d use this flow:

  1. Form Trigger / Gmail / Manual upload — receive the PDF binary.
  2. Mistral OCR / Document extraction — return Markdown or text.
  3. Code node — parse the Markdown table and return one item per PDF row.
  4. Google Sheets → Append Row — map columns from each item.

If Mistral returns a Markdown table like | name | amount | date |, try this Code node after the OCR node:

const markdown = $json.markdown || $json.text || $json.output || '';

const tableLines = markdown
  .split('\n')
  .map((line) => line.trim())
  .filter((line) => line.startsWith('|') && line.endsWith('|'));

if (tableLines.length < 2) {
  throw new Error('No Markdown table found in OCR output');
}

const splitRow = (line) =>
  line
    .split('|')
    .slice(1, -1)
    .map((cell) => cell.trim());

const headers = splitRow(tableLines[0]);
const dataRows = tableLines
  .slice(1)
  .filter((line) => !/^\|?\s*:?-{3,}/.test(line.replace(/\|/g, '').trim()));

return dataRows.map((line) => {
  const cells = splitRow(line);
  const row = {};

  headers.forEach((header, index) => {
    row[header || `column_${index + 1}`] = cells[index] || '';
  });

  return { json: row };
});

Then in Google Sheets, append using fields from the incoming item. Do not put the whole OCR result into one cell, and do not wrap all rows inside a single rows array unless you split it again before Sheets.

For Bangla PDFs: if the PDF is digitally generated/selectable text, Bangla should pass through as Unicode and save to Google Sheets fine. If it is scanned/image-based, use an OCR provider with Bangla language support or language hints, then run the same “one extracted row = one n8n item” step before Sheets.

Transparent note: I built this row-splitting blueprint with FlowForge AI and adapted it to your “Mistral extracts but Sheets gets one row” problem.

Many thanks for your email. yes Mistral returns a Markdown table like | name | amount | date |. Should I pest this code into extract information node in n8n? Or where I will past the code?

Hi Azizul,

Thanks for the samples; they made the issues clear.

Two answers:

  1. Only one row saving

This is not a Mistral problem — your extraction is actually working; Mistral is reading the full table. The problem is the step that writes to Google Sheets. Right now all the rows arrive together as ONE item, so the “Add Row” step runs only once and writes a single row.

Fix: before the Google Sheets step, add a step that splits the rows into separate items —

  • Make.com: add an “Iterator” pointing at the rows array, then keep “Add a Row” after it. It will then run once per row.
  • n8n: add a “Split Out” node on the rows field, then “Append Row” after it.

Also make sure Mistral returns the table as a JSON list (one object per row), not one block of text — otherwise there is nothing to split.

  1. Bangla PDF

Your Bangla challan is digitally created, but its text layer is broken if you extract the text directly you get wrong/garbled letters. So do NOT extract text first for Bangla files. Send the PDF page itself to Mistral OCR (as an image/document). Mistral OCR reads the picture and supports Bangla well, so you get correct Bengali text.

One note: the challan is a different layout — a report with headings and totals, not a flat table like the data file, so it will need a different column mapping than your English files.