How to dynamically append any CSV (with different columns) from Webhook to Google Sheets?

Hello everyone,

I’m stuck on a workflow and would really appreciate your help.

My flow:

  • Webhook receives a CSV file (can be any structure/columns)
  • Parse CSV node (working fine, gives me items with dynamic headers)

Problem:
I want to push this data into Google Sheets dynamically — meaning:

  • Automatically create column headers from the CSV on first run
  • Support any kind of CSV without me manually mapping column names every time
  • No pre-defined headers in the sheet

I don’t want to hardcode column names because the CSVs will have completely different columns each time.

How can I configure the Google Sheets node (or use Code node + something else) to auto-detect headers and append rows dynamically?

Any working example or suggestion would be great. Thanks!

Hi @AbdullahShah Welcome!
You don’t need a Code node for this. The Parse CSV node already outputs each row as an item keyed by the CSV headers, so those keys can become the column names directly.
In the Google Sheets node, use the Append Row operation and set Mapping Column Mode to Map Automatically. Then open Options and confirm Handling extra fields in input is set to Insert in New Column(s) (the default). On an empty sheet this writes the headers from the CSV field names on the first run, and a CSV with different columns adds its own new columns on later runs.

(post deleted by author)