-
A Google account
-
create an API key at https://creativecommons.tankerkoenig.de/
-
create a Google Sheet, e.g. in Google Drive and note the alphanumerical ID in the URL
-
write in row 1 header cells date, dateUtc, iso_calendarweek, station_key, station_status, price_e5, price_e10, price_diesel -- the exact spelling doesn't matter. Google Apps Script will simply append the data from the next empty row.
-
create a new project in https://script.google.com/home
-
Find gas stations in your vincinity with an API call, e.g. in your browser to https://creativecommons.tankerkoenig.de/json/list.php?lat=52.521&lng=13.438&rad=1.5&sort=dist&type=all&apikey=00000000-0000-0000-0000-000000000002 (adapt your lat lon values and the apikey) -- in the code you will need to make a comma-separated string from those
See below file "Code.gs", paste it in the new Google Script project. Rename the "Unbenanntes Projekt" to something meaningful, it will become an "app" name. The same app name you will see at https://myaccount.google.com/permissions after you granted access permissions in the next step.
In the Google Script editor windows, click
When asked to "Autorisierung erforderlich Für dieses Projekt ist Ihre Erlaubnis zum Dateizugriff erforderlich." click "Berechtigungen überprüfen"
In the Google Script editor, use in the left menu the "watch" symbol to define a trigger, e.g.
- Choose which function to run: main
- Which runs at deployment: head
- Select event source: time driven
- Select type of time based trigger: minutes timer
- Select minute interval: every 15 min
Hi,
if the code doesn't work for you just drop a note here in the comments!
BR
//cpm