Showing results for 
Search instead for 
Did you mean: 

Retrieve data via REST API and post it to a Google Sheet



I am trying to build something for work internally so we can get the data from our time tracker into our Google Sheet report.

Unfortunately I have next to zero knowledge about this.. After a few days of Google research I came this far:


function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Clockodo API')
      .addItem('pull data','Clockodo')
function Clockodo() {
var options = {};
options.headers = {"Authorization": "Basic " + Utilities.base64Encode('email' + ":" + 'token')};
var response = UrlFetchApp.fetch(options);
var data = response.getContentText();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("api_test");
sheet.getRange(sheet.getLastRow() + 1,1).setValue([data]);

The data arrives all in 1 cell like this:


And I just cannot figure out how to get this organized into columns or where to add which columns to pull.

If anyone can point me in the right direction I would be very grateful 



Most REST APIs are used to interface with a database or perform other actions. Therefore, to interface with a Google Sheet, you first need to find a REST API that returns data. Then you need to find a way to make that data used for a Google Sheet. This can be done using Google Apps Script to execute queries on a Google Sheet.


Good comment... Excellent work... Click here