Skip to content

Instantly share code, notes, and snippets.

@lukethacoder
Last active August 12, 2020 11:18
Show Gist options
  • Save lukethacoder/48b4c2f61aa15d20fa42973396420015 to your computer and use it in GitHub Desktop.
Save lukethacoder/48b4c2f61aa15d20fa42973396420015 to your computer and use it in GitHub Desktop.
Google Sheets Function for fetching Accounts and their current values

Up Accounts API

  1. Create a new Sheet (or use an existing one)
  2. Tools -> Script Editor
  3. Copy + Paste the attached .js code snippet (Save)
  4. Back on the sheet, paste in =FetchAccounts("up:yeah:THE_REST_OF_YOUR_TOKEN_HERE", 0)
  5. Profit

Don't have an API token, get one here.

Still stuck? Check out the Up Bank API Developer Docs

function FetchAccounts(token, placeholder) {
const url = "api.up.com.au/api/v1/accounts"
const params = {
'headers': {
'authorization': 'Bearer ' + token,
}
}
const response = UrlFetchApp.fetch(url, params);
const data = JSON.parse(response.getContentText()).data
const result = data.map(function(obj){
return [obj.attributes.displayName, obj.attributes.balance.valueInBaseUnits / 100]
})
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment