Looping with node execute once in the middle

How can I create a flow where I get a list of items from a google spreadsheet and load it to an endpoint of an api, between these nodes there is a node that performs authentication, I would like this node to run only once, but the token obtained was used in all iterations of the subsequent node.


To configure the node to run only once (no matter the number of items), open the node, go to settings, and turn on the option Execute Once. Check the image below.

Does the API Authentication node depend on data from the Google Sheets node? If not, you can do something as shown below. Remember that the Add Items node has to reference only the first output of the API Authentication node. Else, it will work only for the first item. You do this by adding $items(0) before the expression. All together should look similar to $items(0).$node["HTTP Request"]["variable that holds the key"]. This is just needed for the authentication part. When referencing the output of the Google Sheets node, you can simply do $node["Google Sheets"]["key you need"].

Thanks @RicardoE105 , it worked perfectly using {{$item(0).$node["HTTP Request"].json["accessToken"]}}, I didn’t find the use in this way in the documentation, just $items, as you suggested, is there any difference?