Okay. This is the case when I dont’t know what Im doing, but somehow I got to the expected end result.
I will leave this to “future myself” or in case someone goes through similar problem.
After I got data populated according the filtered Id’s I faced a problem where it didnt mapped correctly.
So I stared on this for an hour or two and decided to go in same manner as as pprevious step before:
var arr1 = steps.nodejs_5.$return_value
var arr2 = []
for (var i=0; i < arr1.length; i++) {
arr2.push(
arr1[i].data.map(events => [
events.location_lon,
events.location_lat,
events.location_name,
events.id,
events.name,
events.start,
events.end,
events.featured,
events.image_url,
events.details,
events.permalink,
events.learnmore_link])
)
}
return arr2
Short was my moment of joy, because next I received an 400 error from Google sheets - no data went in. Fortunately I fast enough figured that the response goes in one array level more than necessary, like [[[response array]]].
so in the end, with a help of Google gods, i got to some other souls topic where was a suggestion add .flat()
so, I added this on my last step ending line to get from [[[response array]]] to [[response array]]:
return arr2.flat()
And that’s it. After multiple testings with IDs I managed to:
- Check whether Id’s already synced
- Populate data from source JSON with unsynced ID’s
- Map data so it complies with Google sheet requirements
- Send it successfully to Google sheets.
Thanks author that went through similar problem a year before me. :))
With this text of line I end my 24+ hour hopelessness and empty staring on screen by doing things I dont understand how to do properly.
Thank’s developers for such great service!
I will advance on paid membership, as I see more and more useage for my projects.