I am trying to create a workflow which fetches data from multiple google sheets. We have to merge all the data and enter into openAI node.
This workflow is possible by converting the google sheets data into csvData and further into BinaryData to input int google drive (which creates a CSV file) which is further inserted into openAI node(this is done to avoid openAI hitting token limits since the data is huge).
Now, I am not able to convert the data from CSV data to binary properly which ends up giving me error in the google drive node - saying there is no binary data present in the file.
Theoretically you could replicate the process with what youâre doing in the Code node but you also would need to create a physical temporary file, which is not possible if you use cloud n8n.
What the error says?
Please help to help you by reducing the room for guesswork.
Would be also helpful if you could pin some data in critical nodes, as errors can stem from data structure.
So as you can see in the attached screenshot that the csvData is not converted to binary data (although it is shown in the binary data tab). Hence, when feeding it to the next node(upload in google drive) it gives an error saying - âThe item has no binary field âdataâ [item 0] Check that the parameter where you specified the input binary field name is correct, and that it matches a field in the binary inputâ
No matter whatever parameter I add, it is not taking in the input only.
Do you have any suggestions/improvements I can make in this workflow?
you are expected to put a literal name of the field n8n would put binary data in.
This can be data, csv, file - whatever you will then use in GDrive node.
If you were referring it later in a Code node, youâd address it as $binary.binaryFieldName or $binary["binaryFieldName"].
You my ask how the Convert node knows which data to âbinarizeâ?
It will take outputs from previous node (i.e. input to the Convert node; what youâd refer as $input.all() in a Code node), where each item is an object representing one row in csv. Each object is { "column name X": value, "column name Y": value }
So, output from previous node would be:
[
{ "column name X": value11, "column name Y": value12 },
{ "column name X": value21, "column name Y": value22 }
]
There are chances that you do not need your current Code node at all.
I cannot remember if the first item should represent human readable column names or the column names are just inferred from object keys. Try to figure this part out yourself.
P.S. Please whenever asking a question provide a broader context. Ideally, a workflow with some pinned data along with error messages and explanations.
The code node that I have added is basically to merge all the data coming from 3 different google sheets to one single CSV file(which is essential for this workflow). I donât think we can remove this code node since, if I try to directly link it to âconvert to fileâ node it would only give me options to select particular data points from sheets, not all the data combined.
Regarding the âconvert to fileâ node, I have tried taking up a literal name of the field i.e. data in this node but still at the end when I view the generated file CSV file, I see the data is not actually binary. Hence, when it gets forwarded to further nodes being google drive and then openAI, it returns that no binary data is present in the file.
So, in my understanding the core issue lies with the data not being properly converted to binary format.
I am pinning some data from the outputs I have received by running the workflow. Adding screenshots wherever pinning data is not available (binary outputs can not be pinned)
P.S: Appreciate all the tips and feedback I can get on this, since I am still in the learning stage!
On your point 1, you can use Merge node to combine (as opposed to current approach when entries are appended) data, probably with some options to resolve conflicts between identically named keys.
On your point 2, from your last screenshot I can see you have binary data ready. The fact you can read it doesnât mean it is not binary. What is it that you expected to see? Does it get processed by the subsequent upload node? From data pinned to Google Drive node, it is saved succesfully.
Although, I am not sure if your model connected to AI Agent would be able to consume binary data. You may need to aggregate it into some field under json or even transform to plain text or markdown before feeding it to AI Agent.
Thanks for the help mate! I think you were right, it actually is converting the data correctly. I just passed it in the right format to the openAI node.