Merge all google sheet at once - in just one (or few nodes)

Describe the problem/error/question

So, this is one of my workflow. Toooooo much that cannot copy the code here at once.
Let me explain:
This is the workflow that will taking data from all related sheet in a file to help the AI learn and making idea for social posts.
Materials: I have a google sheet of separated data that for specific position. For: content strategy for the whole business, design guideline for visual design, content direction for campaign…
So, we cannot add all of those data into one sheet.
Workflow:

  • It must take all the data from all related sheet at one, then give it to the chat GPT to learn then generate the idea.
  • So, I have to use merge nodes for merge all of them. That’s reason why the workflow like you see below.

What is the error message (if any)?

No error. I just want to:

  1. In the current:
    Optimize the workflow of merging into fewer nodes.
  2. In the future:
    So, currently, I just take all the data from a specific sheet in that file.
    But in the future, I have to select exact rows to execute for optimize the cost (The more the AI read, the more cost we spend)
    So, is there any method to make it?

Please share your workflow

Check the next reply please

Information on your n8n setup

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

hello @mivtool

It can be simplified. But it’s hard to say what exactly should be done without the samples of the google sheet nodes.

For example, you can replace the nodes in the green zone with the next setup:

You can do the same with nodes in the red zone, but that will be a little tricky and it’s hard to provide the working example (it will look as a code node, g sheet node and something after. That could be another code node or set of usual nodes, depending of the context)

And I can’t determine why you have used the multiplex mode for the merge, as it will nearly double the output for each merge node.

There is another approach, like in the below with more granular configuration for each sheet:

2 Likes

Thanks a lot, it solved the problem.
I’ve just shared the google sheet file to public for someone if needed.
In my complex workflow, I use the multiplex because it will create only one row only as you can check.
But now I don’t need it anymore :smile:

So I make the payload like this and give the info to the AI.
But nodes in the redzone have to be doing like I did before if want to gather all of their info in one.
Is there any way to fix this?

Moreover, if one of the note give the empty result.
It seem that the whole workflow will stop at that note.
If forcing it to make the output, then the next node will make the output of just title without detail like below as you can check in the node Edit Activities after the Activities node.

Thanks for the samples. Here is an example of how to do it.

You can define the output for the OpenAI node directly in the Code node, or you can keep it inside the OpenAI node

1 Like

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