Skip to content

Instantly share code, notes, and snippets.

@filiph
filiph / fio-api-fetch.js
Created March 13, 2013 07:41
A simple script that fetches the Fio bank transaction data for you and pastes them into your spreadsheet. I'm afraid you're on your own while getting this to work for you, but here are the pre-requisites: 1) the Fio API token from the bank should be set in File > Project properties > User properties as `fioApiToken`. 2) The sheet 'rawData' must …
/**
* Fetch JSON from the API.
*/
function fetchLatestJson() {
var token = UserProperties.getProperty("fioApiToken");
if (token === null) {
throw "Fio API Token not set. Please go to File > Project properties > User properties and create token fioApiToken.";
}
var response = UrlFetchApp.fetch("https://www.fio.cz/ib_api/rest/last/"+token+"/transactions.json");
if (response.getResponseCode() !== 200) {