1. Add the script
1
Open the script editor
In your Google Sheet, choose Extensions → Apps Script.
2
Paste the script
Delete what is there and paste the script below. Choose Save.
Code.gs
2. Add your key
1
Open Script Properties
In the script editor, choose Project Settings (the cog), then Script Properties → Add script property.
2
Add the key
Property:
SCOUTWORKS_API_KEY. Value: the sandbox key to try it, or your own key. Choose Save script properties.3. Run it
Choose importMembers in the toolbar and press Run. Google asks for permission the first time: it needs to reach an external service and to edit this sheet. Then open the Members tab.4. Refresh it every morning
1
Add a trigger
In the script editor, choose Triggers (the clock), then Add Trigger.
2
Set the timer
Function:
importMembers. Event source: Time-driven. Type: Day timer. Time: 6am to 7am. Choose Save.5. Switch to your group
In the script, changeapi-demo.scoutworks.app to api.scoutworks.app. In Script Properties, replace the sandbox key with your own. Your key needs the members:read scope.
Read only what changed
The script above reads every member each morning. For a large group, this version reads only the members that changed since the last run. It keeps each member’sid in column A, so it can update or remove that row.
Code.gs
fetchScoutworks() and safe() from the first script. Point the morning trigger at syncMembers in place of importMembers. Each morning it reads only what changed. Once a week it reads every member and rebuilds the tab, which removes members who left and picks up parent links and renames. To force a full read, delete the SCOUTWORKS_MEMBERS_FULL_AT script property. Pagination explains updatedSince and nextUpdatedSince.
Other lists
Change the URL and the columns to read another list:
The API reference lists every field.