Quick demo of data sharing
There are many ways to accomplish this of course, but using Caching across multiple Apps Script and Node projects using a selection of back end platforms is pretty fast to set up. To test this, here’s a challenge that shares the data in a spreadsheet with node, set up end to end in less than 5 minutes.
- Upstash as the back end crusher platform and get credentials
- bmPreFiddler to deal with the data in the spreadsheet
- bmcrusher-node as the node client
- scrviz to quickly find the apps script library credentials
Assume you’ve set up an upstash account and have a graphql access key. See Upstash as an Apps Script cache platform if you haven’t done that before.
Create an apps script project, and find and add the necessary libraries
We can use scrviz to quickly find the library keys, which are normally a pain to find
- find and add bmCrusher
- find and add bmPreFiddler
We’re going to get a sheet from this spreadsheet that contains a bunch of stuff about the main airports worldwide.
so all we need is the spreadsheetId and the name of the sheet, get the data, and write to the upstash store.
Code for getting spreadsheet data and writing to cache
I’m picking my upstash access key from the property store – obviously you do whatever to pass over your key. And that’s all there is on the Apps Script side.
Here’s what the data looks like in the back end upstash store.
The node client is even briefer, but first install the bmcrusher-node module from npm using either npm or yarn
Here’s the code
I’m picking up my upstash access code from a file, but you do whatever here to get yours.
And we’re done – in less than 5 minutes –
Of course you could process the data in some way if you want, and write it back for Apps Script to pick up, clean up the store etc.
scrviz Apps Script bmCrusher: https://scrviz.web.app?repo=brucemcpherson%2FbmCrusher
scrviz Apps Script bmPreFiddler: https://scrviz.web.app?repo=brucemcpherson%2FbmPreFiddler
github bmcrusher-node: https://github.com/brucemcpherson/bmcrusher-node