Fetch API data from Bittrex - json

I'm trying to fetch the API data with Google Apps Script about my balance on Bittrex but it returns me nothing, no errors and only blank cells. This is the code I've written based on the documentation here: https://bittrex.com/Home/Api
function getBalance() {
var ss = SpreadsheetApp.openById("***");
var data = ss.getSheetByName("Data");
var key = ss.getSheetByName("Api").getRange('A2').getValue();
var secret = ss.getSheetByName("Api").getRange('B2').getValue();
var baseUrl = 'https://bittrex.com/api/v1.1/';
var nonce = Math.floor(new Date().getTime()/1000);
var command = "/account/getbalances";
var uri = baseUrl.concat(command + "?apikey=" + key + "&nonce=" + nonce);
var signature = Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_512,
uri,
secret);
signature = signature.map(function(byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('')
var headers = {
"apisign": signature
}
var params = {
"method": "get",
"headers": headers,
}
var response = UrlFetchApp.fetch(uri, params);
var json = JSON.parse(response.getContentText());
var blnc = [];
blnc.push(['Balance']);
for(var key in json.result)
{
blnc[0].push(json.result[key]);
}
askRange = data.getRange(2, 2, blnc.length, 1);
askRange.setValues(blnc);
}
The askrange last number is "1" because the script only pass the "Balance" value to the spreadsheet, but the values should be something around 210. Any help? Thank you

I solved it, the problem was in the "command" variable, there was a slash not needed that generated an url with a double slash

Related

Authentication Issues with CallRail --> Google Sheets API Calls with Google Apps Scripts [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 days ago.
Improve this question
I have been trying to use CallRail's API (documentation: https://apidocs.callrail.com/) to push data to a Google Sheet via a Google Apps Script. We are working with a healthcare company, so the idea is to push all non-sensitive data to a Google Sheet that we can use a source for Looker Studio. I cannot get it to work properly, and cannot for the life of me figure out why. CallRail's support hasn't been much help. Any ideas? Here's my current code:
function getCallData() {
// HTTP request header
var header = {
"Authorization": "Token token=" + myToken,
};
let companyId = "XXXXXXXXX";
let accountId = "XXXXXXXXX";
var ss= SpreadsheetApp.getActiveSpreadsheet();
var mainSheet = ss.getSheetByName("Main");
mainSheet.getRange('A1:A5000').clear();
var myToken = "XXXXXXXXXXXXXXX"
var URL_STRING = "https://api.callrail.com/v3/a/XXXXXXXX/calls.json";
var response = UrlFetchApp.fetch(URL_STRING);
var json = response.getContentText();
var data = JSON.parse(json);
var callid = data.calls[5000].id;
var duration = data.calls[5000].duration;
var starttime = data.calls[5000].start_time;
var answered = data.calls[5000] .answered;
mainSheet.getRange(2,1).setValue([callid]);
mainSheet.getRange(2,2).setValue([answered]);
mainSheet.getRange(2,3).setValue([duration]);
mainSheet.getRange(2,4).setValue([starttime]);
}
I tried using CallRail's documentation as well as online guides, but just can't get it to work. Here are two more examples of code I've tried:
function pushDataToGoogleSheet() {
var sheet = SpreadsheetApp.getActiveSheet();
// CallRail API endpoint
var url = "https://api.callrail.com/v3/calls?start_date=2022-01-01&end_date=2022-12-31";
// CallRail API key
var apiKey = "your-api-key-here";
// HTTP request header
var header = {
"Authorization": "Token token=" + apiKey,
"Accept": "application/json"
};
// Send HTTP GET request to the API endpoint
var response = UrlFetchApp.fetch(url, {
"headers": header
});
// Parse the JSON response
var data = JSON.parse(response.getContentText());
// Write the data to the Google Sheet
var numRows = data.data.length;
var values = [];
for (var i = 0; i < numRows; i++) {
var call = data.data[i];
values.push([
call.id,
call.attributes.created_at,
call.attributes.phone_number,
call.attributes.duration,
call.attributes.recording_url
]);
}
sheet.getRange(sheet.getLastRow() + 1, 1, numRows, 5).setValues(values);
}
var AGENCYID = your_agency_id; // like var AGENCYID = 000000000;
var TOKEN = 'your_api_key'; //like var TOKEN = ‘123abc456def789hij012klm345nop’;
function getSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Sheet1"); // you can change this to whatever sheet you want to populate data on.
return sheet;
}
function writeToSpreadsheet(data) {
var sheet = getSheet();
var calls = data.calls;
// if its the first page, clear the sheet and create a header row.
if (data.page == 1) {
sheet.clear();
var columnNames = Object.keys(calls[0]);
sheet.appendRow(columnNames);
}
calls.forEach(function(call) {
sheet.appendRow(Object.values(call));
});
}
function fetchCalls(page) {
var dateRange = 'yesterday'; // you can change this to any acceptable date range.
var fields = 'company_id,company_name,direction'; // you can change this to any fields you would like to include.
var url = 'https://api.callrail.com/v3/a/' + AGENCYID + '/calls.json?fields=' + fields + '&date_range=' + dateRange;
url += '&page=' + page;
var response = UrlFetchApp.fetch(url, {
'method': 'get',
'headers': { 'Authorization': 'Bearer ' + TOKEN }
});
return response;
}
function getTodaysCalls() {
// fetch page one
var initialFetchResponse = fetchCalls(1);
var initialFetchResponseJson = JSON.parse(initialFetchResponse.getContentText());
writeToSpreadsheet(initialFetchResponseJson);
// now that we have our first response for the api we know the total pages
// so now start fetching on page 2 and stop on the last page
var resp;
var parsedResp;
for (var i = 2; i <= initialFetchResponseJson.total_pages; i++) {
resp = fetchCalls(i);
parsedResp = JSON.parse(resp.getContentText());
writeToSpreadsheet(parsedResp);
}
}

Get specific data from Salesbinder API JSON to a Google sheet

Hi what I'm trying to do is get the data from a Salesbinder invoice API (Invoice # is taken from Sheet2 Cell A1) output the data to a Google sheet (sheet Cell A2)
here's the code i'm using to get data from Salesbinder API
function fetching() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Sheet1');
var sheet2 = ss.getSheetByName('Sheet2');
var InvNumber = sheet2.getRange('A1').getValue();
var USERNAME = 'APIKey';
var PASSWORD = 'x';
var url = 'https://mydomain.salesbinder.com/api/2.0/documents.json?documentNumber='+InvNumber+'&contextId=5';
var headers = {
"Authorization": "Basic " + Utilities.base64Encode(USERNAME + ':' + PASSWORD)
};
let response = UrlFetchApp.fetch(url, { headers });
Logger.log(response.getContentText());
}
The result I get from the data is like this
{"document":[{"document_number":8542,"name":"VIOLET BEARINGS","context_id":5,"total_cost":7213.03,"total_tax":415.45,"total_tax2":0,"total_price":8309.08,"total_transactions":0,"issue_date":"2022-12-13T00:00:00+00:00","expiry_date":null,"shipping_address":"(Same as above)","date_sent":null,"shipped_percent":null,"status_id":9,"public_note":"","attention":"GLEN","payment_terms":"","id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","customer_id":"5b0d881b-6a88-46e5-998c-06330a8e0006","user_id":"5b0d75b3-e9cc-4899-bf99-77610a8e0006","associated_document_id":"","created":"2022-12-13T21:21:43+00:00","modified":"2022-12-21T16:01:04+00:00","status":{"id":9,"name":"unpaid"},"context":{"id":5,"name":"invoice"},"customer":{"id":"5b0d881b-6a88-46e5-998c-06330a8e0006","name":"TestClient","customer_number":1889,"billing_address_1":"Add1","billing_address_2":"Add2","billing_city":"TestCity","billing_region":"TestLoc","billing_postal_code":"TestPost","billing_country":"CANADA","shipping_address_1":"Add1","shipping_address_2":"Add2","shipping_city":"TestCity","shipping_region":"TestLoc","shipping_postal_code":"TestPost","shipping_country":"CANADA"},"user":{"first_name":"test","last_name":"test"},"document_items":[{"id":"0ea11906-f197-4eb4-971e-715d4dc77ab2","name":"B-0832","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"JGE/H/K DOOR GASKET","quantity":8,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":38.1,"price":43.81,"discounted_price":0,"weight":2,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"2b7e9376-ed70-4e75-95c9-6237aad8cfc0","name":"B-0770","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"MAIN BEARING JGE/H/K","quantity":8,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":282.73,"price":325.14,"discounted_price":0,"weight":6,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"391c2ec1-e02d-4390-9a10-429c2ea460fc","name":"B-2082","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"ROD BEARING JGE/H/K","quantity":8,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":282.73,"price":325.14,"discounted_price":0,"weight":5,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"725fb97d-243f-44aa-98d0-50d903871ae4","name":"B-0776","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"THRUST PLATE JGE/H/K","quantity":2,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":878.44,"price":1010.21,"discounted_price":0,"weight":7,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"956cf37e-3921-4cad-94bf-670cdedd2d17","name":"B-1032","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"JGK DOOR GASKET","quantity":8,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":17.21,"price":19.79,"discounted_price":0,"weight":3,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"c2b74c55-465b-4bee-84a1-6c9e8e5bd102","name":"A-0661","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"OIL FILTER","quantity":3,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":24.5,"price":28.18,"discounted_price":0,"weight":4,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-15T15:43:57+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"de2c8695-9589-4856-be7a-d3979a776646","name":"FREIGHT CHARGE","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":1,"service_category_id":"5e6a78e2-cf6c-437c-ac52-0c3a0a8e000a","description":"RE:E2920103","quantity":1,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":70.64,"price":95.35,"discounted_price":0,"weight":8,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-21T15:34:51+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null},{"id":"eab3c271-20ce-4c4e-af92-8553425eaa71","name":"C-6200","document_id":"0b24e8d2-e7cc-4441-abd7-337c8a2c6cf1","item_id":null,"unit_id":4,"service_category_id":"5dc2f6d2-27e0-4dac-a2b7-39080a8e0008","description":"TOP COVER GASKET","quantity":1,"quantity_partially_received":0,"quantity_partially_shipped":0,"tax":5,"tax2":0,"discount_percent":0,"cost":345.85,"price":397.73,"discounted_price":0,"weight":1,"modified":"2022-12-21T16:01:04+00:00","created":"2022-12-13T21:21:43+00:00","item_variations_location_id":null,"item_variation_data":null,"delete":false,"item":null}]}]}
I would like to output the JSON content to look like this on my google sheet
https://docs.google.com/spreadsheets/d/18x1cyztf5SgnKZHjqgWx2iP7SzQAksOzE_EVZoUOcy8/edit#gid=0
Any help would be greatly appreciated
Thanks
In your script, when the value of response.getContentText() is your showing data, how about the following modification?
From:
Logger.log(response.getContentText());
To:
Logger.log(response.getContentText());
// I added the below script.
const value = JSON.parse(response.getContentText());
const addValues = [value.document[0].customer.name, value.document[0].issue_date, value.document[0].attention, value.document[0].name];
const res = value.document[0].document_items.map(o => [value.document[0].document_number, ...["name", "description", "quantity", "price", "discounted_price"].map(h => o[h]), ...addValues]);
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
sheet.getRange(sheet.getLastRow() + 1, 1, res.length, res[0].length).setValues(res);
Please set your sheet name to getSheetByName("Sheet1").
Unfortunately, I cannot find External PO# you expect from your data.
Suggestion: Clean and Extract the Required Data
The first thing I noticed is that your current script has already extracted a single JSON object from Salesbinder. However, the format returned is hard to read. You may use JSON beautify sites online to rearrange and analyze the JSON object you have produced like JSON Viewer (DISCLAIMER: I am not affiliated with the website, I just find it helpful to share it to others due to its helpful features).
Script
Afterwards, you may be able to access the data you wanted by accessing the JSON object. For your table, you may use the following:
var salesBinderInvoiceNumVal = object.document[0].document_number;
var itemNameVal = object.document[0].document_items[0].name;
var descriptionVal = object.document[0].document_items[0].description;
var quantityVal = object.document[0].document_items[0].quantity;
var priceVal = object.document[0].document_items[0].price;
var discountPercentVal = object.document[0].document_items[0].discount_percent;
var clientNameVal = object.document[0].customer.name;
var issueDateVal = object.document[0].issue_date;
var attentionVal = object.document[0].attention;
var nameVal = object.document[0].name;
Note: The External PO number can't be found since there are no given values in your sample table.
But before doing so, you may want to store the generated JSON object to a variable. Thus, you may change:
Logger.log(response.getContentText());
to:
var object = response.getContentText();
Afterwards, you may add the setValues() function to add the values to the last row of your table. Thus, your script should be somewhat like this:
function fetching() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Sheet1');
var sheet2 = ss.getSheetByName('Sheet2');
var InvNumber = sheet2.getRange('A1').getValue();
var USERNAME = 'APIKey';
var PASSWORD = 'x';
var url = 'https://mydomain.salesbinder.com/api/2.0/documents.json?documentNumber=' + InvNumber + '&contextId=5';
var headers = {
"Authorization": "Basic " + Utilities.base64Encode(USERNAME + ':' + PASSWORD)
};
let response = UrlFetchApp.fetch(url, { headers });
//Changes start here
var object = response.getContentText(); //Store the JSON object to this variable
var lastRow = sheet.getLastRow(); //get the last row
//required values
var salesBinderInvoiceNumVal = object.document[0].document_number;
var itemNameVal = object.document[0].document_items[0].name;
var descriptionVal = object.document[0].document_items[0].description;
var quantityVal = object.document[0].document_items[0].quantity;
var priceVal = object.document[0].document_items[0].price;
var discountPercentVal = object.document[0].document_items[0].discount_percent;
var clientNameVal = object.document[0].customer.name;
var issueDateVal = object.document[0].issue_date;
var attentionVal = object.document[0].attention;
var nameVal = object.document[0].name;
//add the required values to a 2d array
var output = [[salesBinderInvoiceNumVal, itemNameVal, descriptionVal, quantityVal, priceVal, discountPercentVal, clientNameVal, issueDateVal, attentionVal, nameVal]];
sheet.getRange(lastRow+1, 1, 1, output[0].length).setValues(output); //add the 2d array to the last row of your table
}
Output:
Since your script only gets the value of one cell, I assumed that it only fetches one item or one row to your table. NOTE: I only processed the given JSON object in your post since I have no access/account in Salesbinder. I did assume that it was the output of your current script.
Reference:
You may further study about accessing JSON objects date in this article: JSON Object Literals

JSON API Call: Pagination loop - unable to increment offset value

I am trying to make an API call which has a 50 records per call limit, the JSON response gives me "objects" and "total_objects".
I am running into an issue with the code that i managed to put together with help, the output does increment from the 50th record till the 95th record, post which it loops back to print from the 45th record and loops with the same set.
issue: stuck in a loop where the increment is one record at a time and a repeat of 49 old records
var client_id = 'xxxx';
var client_secret = 'xxx';
var email = 'xxx';
var password = 'abc';
var device = '1';
var app_version = '1';
var Token = 'abcde';
// call the API to get data for your list
function AP_Hyd() {
// URL and params for the API
var root = 'https://abcdef:443//v2/';
var endpoint = 'ghij/3241/objects?search=rtewq&limit=50&offset=';
var offset = '0'
// parameters for url fetch
var params = {
'method': 'GET',
'muteHttpExceptions': true,
'headers': {
'Authorization': 'Bearer ' + Token
}
};
// call the API for first offset
var json = getAssetData(root,endpoint, offset, params);
var totalObjects = json.objects;
//Adding data to ActiveGoogleSheet
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clear()
//Adding Column Headings
var headerRow = ['erwf', 'gtre', 'poi', 'hgf', 'lkj', 'zyx'];
sheet.appendRow(headerRow);
//print first batch
printRows(totalObjects,sheet);
//check for any further data available
if (totalObjects) {
let totalPages = json.totals.objects;
//get total number of pages to be retrieved
var pageCount = parseInt(totalPages / 50)
//check for decimal
//if decimal is found increase the value of pageCount by 1
if(totalPages%50 !=0){
pageCount++;
}
Logger.log("pageCount:::" + pageCount +" for total objects:: " + totalPages);
for (i = 1; i < pageCount; i++) {
//invoke again and lets say the response is added in response
// call the API with incremented offset
var pageResponse = getAssetData(root,endpoint, i, params);
var jsonObjects = pageResponse.objects;
//print the rows
printRows(jsonObjects,sheet);
}
}
}
function getAssetData(root,endpoint,offset, params){
var response = UrlFetchApp.fetch(root + endpoint + offset, params);
var content = response.getContentText()
//return the parsed content
//TODO: add null check
return JSON.parse(content)
}
function printRows(jsonData, sheet) {
if (jsonData) {
for (var i = 0; i < jsonData.length; i++) {
var fieldObj = jsonData[i];
;
Logger.log(fieldObj)
// print out all the Columns
sheet.appendRow(row);
}
}
}

How to transform the JSON response into a table in sheets

I'm sending a request to an API (in a Google Scripts), and I'm getting the response as a JSON text that looks like this:
[{"id":26319355,"name":"1. WAW -FIRST SESION","calendar":"Glovers
Click&Collect","duration":30,"isSeries":false,"slots":90,"slotsAvailable"
:89,"color":"#E3DE7D","price":"0.00","category":"WAW","description":"",
"calendarID":2978881,"serviceGroupID":2978881,"appointmentTypeID":10104780,
"calendarTimezone":"Europe\/Madrid","time":"2019-06-01T12:00:00+0200",
"localeTime":"June 1, 2019 12:00"},
{"id":26466803,"name":"1. WAW -FIRST SESION","calendar":"Glovers
Click&Collect","duration":30,"isSeries":false,"slots":90,"slotsAvailable"
:89,"color":"#E3DE7D","price":"0.00","category":"WAW","description":"",
"calendarID":2978881,"serviceGroupID":2978881,"appointmentTypeID":10104780,
"calendarTimezone":"Europe\/Madrid","time":"2019-06-07T14:00:00+0200",
"localeTime":"June 7, 2019 14:00"},
I want to paste this response as a table in my spreadsheet.
My script actually looks like this (where response is the response I get from the API request):
function CheckAv(row,acuityid,check,url,apiusername,apisecretkey,ss) {
var header = {
"contentType": "application/json",
"headers":{"Authorization" : " Basic " + Utilities.base64Encode(apiusername + ":" + apisecretkey)},
"method" : "GET"
}
muteHttpExceptions: true
var response = UrlFetchApp.fetch(url, header);
var data = JSON.parse(response.getContentText());
var text = response.getResponseCode();
Logger.log(text);
}
I assume it will be really easy but I can't find the solution.
You can cycle through your JSON structure and push each key and value to a specified row using the code below.
json = [{your: "JSON", data: "goes"}, {in : "here"}]
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var rows = [],
data;
for (i = 0; i < json.length; i++) {
for (j in json[i]) {
dataq = json[i][j];
Logger.log(dataq);
rows.push([j, dataq]);
}
dataRange = sheet.getRange(1, 1, rows.length, 2);
dataRange.setValues(rows);
}

Fetch json API data from GDAX

I'm trying to get the BTC-EUR ticker from GDAX site to Google Spreadsheet using a script. I got this code but it doesn't work, always returning me error: The coordinates or dimensions of the range are invalid.
var baseUrl = 'https://api.gdax.com';
var data = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("GDAX");
function ticker() {
var request = "/products/btc-eur/ticker";
var requestUrl = baseUrl + request;
var response = UrlFetchApp.fetch(requestUrl);
var json = JSON.parse(response.getContentText());
var rows = [],
jsondata;
for (i = 0; i < json.length; i++) {
jsondata = json[i];
rows.push([jsondata.price]);
}
dataRange = data.getRange(14, 1, rows.length, 1);
dataRange.setValues(rows);
}
I'm using the same code to push my balance to the spreadsheet, and it is working. I cannot understand why this one return me the error. If I log the json var I get the correct values from the site.
Anyone can help? Thank you
How about a following modification?
Modification points :
The JSON data from https://api.gdax.com/products/btc-eur/ticker is as follows. In this data, the value of price is only one. So when the JSON data is always like this, you can directly retrieve the value using json.price.
{
"trade_id": 4314549,
"price": "3691.06000000",
"size": "0.00004053",
"bid": "3691",
"ask": "3691.05",
"volume": "945.78845044",
"time": "2017-01-01T00:00:00.000000Z"
}
When this is reflected to your script, the modified script is as follows.
Modified script :
function ticker() {
var baseUrl = 'https://api.gdax.com';
var data = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("GDAX");
var request = "/products/btc-eur/ticker";
var requestUrl = baseUrl + request;
var response = UrlFetchApp.fetch(requestUrl);
var json = JSON.parse(response.getContentText());
var rows = [[json.price]];
var dataRange = data.getRange(14, 1, 1, 1);
dataRange.setValue(rows);
}
If I misunderstand your question, I'm sorry.