Skip to main content
  • For: treasurers and trustees
  • You get: a Restricted funds tab with one row per fund, and a Fund movements tab with every transfer in and out
  • Time: about ten minutes
  • Scopes: accounting:read
Money given for a purpose, such as a grant for new tents, can only be spent on that purpose. Trustees must be able to show where each restricted fund stands. This recipe lists every fund with what came in, what was spent and what is left, as the Restricted funds page in Scoutworks shows it.

1. Try the request

Paste this into a terminal to see the demo group’s funds:
Each fund carries these figures, in pounds:

2. Add the script

In your Google Sheet, choose Extensions → Apps Script. Delete what is there, paste the script below and choose Save.
Code.gs

3. Add your key and run it

Choose Project Settings (the cog), then Script Properties → Add script property. Property: SCOUTWORKS_API_KEY. Value: the sandbox key to try it, or your own key. Then choose restrictedFunds and press Run. Open funds come first. A fund that has spent more than it holds says Overspent: the overspend has come out of general funds, and the trustees should know.

4. Switch to your group

Change api-demo.scoutworks.app to api.scoutworks.app, and replace the sandbox key with your own. The key needs only accounting:read. The sheet holds no names, so it is safe to share with every trustee.

For the annual accounts

The figures are for the whole life of each fund, not for one accounting year. For the restricted funds note in your annual accounts, you need each fund’s balance at the start and end of the year, and what came in and went out in between:
  • In and out during the year: read the transactions with from and to set to the year. Keep each line whose restrictedFundId is the fund. A split line carries its fund on each entry in splits instead, so add up the split amounts whose restrictedFundId is the fund too. Then add the fund’s movements dated in the year.
  • The opening balance: the fund’s allocated, plus every line and movement dated before the year starts. A read with from and to gives only the year itself.

If something goes wrong

  • 403 insufficient_scope: the key does not have accounting:read.
  • A fund is missing: every fund is listed, open and closed. Check the fund was set up as a restricted fund in Scoutworks, not as a budget.
See Errors for every code.