I am trying to import all Pipedrive deals and writing the information I need in Google sheets.
What I am already able to do: Access the feed and parse the data to a variable. And print this variable into 1 cell. Of course this isn't workable yet.
The code is somewhat scavenged (building while I'm learning)
// Standard functions to call the spreadsheet sheet and activesheet
function alldeals() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
//the way the url is build next step is to itterate between the end because api only allows a fixed number of calls (100) this way i can slowly fill the sheet.
var url = "https://api.pipedrive.com/v1/deals?start=";
var url2 = "&limit="
var start = 0;
var end = start+50;
var token = "&api_token=hiddenforobviousreasons"
//call the api and fill dataAll with the jsonparse.
//then the information is set into the
//dataSet so that i can refill datall with new data.
var response = UrlFetchApp.fetch(url+start+url2+end+token);
var dataAll = JSON.parse(response.getContentText());
var dataSet = dataAll;
//create array where the data should be put
var rows = [], data;
for (i = 0; i < dataSet.length; i++) {
data = dataSet[i];
rows.push([data.id, data.value,data.pipeline_id]); //your JSON entities here
}
dataRange = sheet.getRange(1, 1, rows.length, 3); // 3 Denotes total number of entites
dataRange.setValues(rows);
}
The error I am getting on the sheet.getRange
.
What I want to achieve is put the data in the columns id, value, pipeline_id
Any pointers to what direction I need to go to solve this problem would be awesome! A fix would be nice to but some pointers would be more useful for my understanding.
The error i am getting is the following:
De coördinaten of afmetingen van het bereik zijn ongeldig. (regel 29, bestand 'dealpull5.0')
Loosely translated:
The coordinates of the size of the reach are invalid (line29,file "dealpull5.0")