Mapping of data extracted from a PDF to Google Sheets

I am facing an issue with N8N when extracting data from a PDF document. I am using the Extract from File, AI Agent, and ChatGPT Model modules to extract the file content and structure the data in JSON, with the goal of mapping it into a Google Sheet.

However, the JSON generated in the OUTPUT tag does not allow me to clearly identify the different elements separately. I am unable to isolate each item under a specific tag to match them with the columns in my Google Sheet.

Has anyone encountered this issue before? Is there a specific method or configuration to properly structure the data and facilitate mapping to Google Sheets?

Thank you in advance for your help! :blush:

1 Like

Hey @Abdel_UNK13 - It looks like you are not getting proper JSON output from the model. It’s quite normal for models to output in these code blocks that you see ```
You should make use of the Structured Output parser Structured Output Parser node documentation | n8n Docs

Here an example:

Hi, @jksr thanks for your help, Structured Output parser is no avaible for me
do you have an other solution please?

Hi Abdul;
Here are some thoughts which might help you -

  • Your AI Agent is spitting out json ur not picking the right key it looks like ;
  • If ur looking to parse pdf use lammaindex.ai quite a relevant service offering and will even parse jpg. I have a complex flow like this which just throughout transcription from invoice perfectly using llamaindex.ai
  • If the requirements is only to parse ; then use basic LLM with structured output.
  • Use GPT to fetch 20 json output example and use the structure parser with example option.

Hope this’ll help :wink: All the best

Hi @PSM-n8n Thanks for your message, I can’t find the Structured Output Parser, even though I have the latest online version of n8n. Do you have any idea why?

Better use the extractor Node, which im using like this ..

For the Structured output , check this

hi every body

@PSM-n8n, @jksr Thanks a lot all it’s ok now.

2 Likes