Been trying to find why my workflow is not successfully passing the spreadsheet ID/URL from one branch to another (see below image):
Basically the first branch scrapes data and uses one bundle to create a spreadsheet name with the query search string. The second branch then adds/appends the bundles to the spreadsheet.
When testing the workflow, it seems that the variable is “undefined” even through the input has the data… Ive tried usingt he Google Sheets, Execute Data, Set Nodes, but cant understand why using a variable doesnt work (but without the variable does…)…
Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.
```
<your workflow>
```
That implies to any JSON output you would like to share with us.
Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
Do you have spreadsheetId available in all the outputs of both nodes - “Execution Data” and “Set Bundles To Iterate”?
The error indicates that is is missing somewhere. You showed that is it present in “Execution Data”. I can conclude it is not the case with “Set Bundles To Iterate”.
Yes, its not there as that branch doesnt yet have the SpreadsheetID. I thought the “Execute Variable” allows you to reference the variables across branches? Is there any way to do this? Whats the easiest fix here so I can understand.
Ok thanks I added the Merge Node to “append” the Spreadsheet URL/ID to the bundles of business data. My issue now is I need to add a step in-between the Merge and Google Sheet to prevent the Google Sheet URL and ID from being added to the Google Sheet itself.
Basically, my ask is how can I pass through the Google Sheet meta data (without actually adding it to the Google Sheet)? I only require the Spreadsheet URL and Sheet Name (for the append/update) of the actual bundles I want added as rows to the sheet.
I tried the Split Function, but it only seems to output the URL and Id only.
Hey @Graham_Beck , I do not think that “Append” is the right operation for Merge in your case.
I would imaging the following to be considered
Merge could be used to pass the data from branch 2 only once input is available on both branches (“Chose branch” mode)
You need to have the headers of the spreadsheet created before hand
Having the headers prepopulated (not including the spreadsheet IDs) will ensure the correct automapping of the data
Having access to the spreadsheet ID that was created in the workflow could be achieved by referencing the node that has that data, for example {{ $(Google Sheets).first().spredsheetID }}, see Output of other nodes | n8n Docs
Ok, when I reference the Google Sheets node directly for example: {{ $node[“Google Sheets”].json.spreadsheetId }} it seems to work!
This way I can pass input 2 by itself and reference the Ids from the Node.
Last question, I want to add a Google Drive share request (so after the Sheet is complete) I want it to invite the designated user to the GSheet. Whats teh best way to do this?