Google Sheet converting a Column to a Row

Hi guys.

I am working on Google Sheet right now, and I am struggling with converting a column to a row.

Is there a way to convert a column (picture)

to a row (picture)


It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @semighoti, this is a painful transformation and you will need custom code for this. Assuming each existing dataset has exactly 3 rows it should still be doable though. Before building an example, can you confirm if City | City 1 is the very first row in your input sheet (this will complicate things slightly, as n8n expects a header row) or if there is any header?

Hi @MutedJam

Yes, the City | City 1 is the very first row in my input sheet; and the existing dataset has more than 3 rows, but each set will have the same rows consistently.

I have found this link in the community Convert column to row, but I am not sure if this is the solution for my case. I don’t think the Google Sheet node has a feature to convert columns to rows, but I am thinking of making a loop that converts a column dataset to a row dataset first, then deletes the whole column dataset for a new one coming up for a new conversion. That’s what I am thinking.


Thanks for confirming @semighoti! The n8n Google Sheets node is very much not prepared to handle such a data structure, meaning you’ll have to rely on custom code, the HTTP Request node, and the Google Sheets API documentation here.

Here’s a quick example workflow I’ve put together before I am out for the weekend:

This reads the first two columns from Sheet1 of a Google Sheets document looking like so:


It then transforms this data into rows using the Code node:

Finally, it adds a new sheet output to the Google sheet looking like this:

Hope this helps :slight_smile:

1 Like

Thank you so much @MutedJam. I appreciate your help a lot. Merry Christmas and Happy New Year to you.

1 Like

Thank you @semighoti, I hope you and your family have a very merry Christmas too!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.