I'm trying to connect a smartsheet table to Googlesheets using apps script. I'm able to connect to the smartsheet but pulling the data based on the field names isn't working.
function getSpeakers() {
var speakers = requestsmartsheet();
//console.log("speakers: ", speakers)
var speaker_info = [];
//Here is where I'm having trouble with the field names. Field names are the exact names from the table
for(i=0; i<speakers.length; i++) {
var fields = speakers[i].fields;
speaker_info.push([
fields.FirstName,
fields.LastName,
fields.Email,
fields.E-Number
])
}
console.log("speaker_info: ", speaker_info);
}
function requestsmartsheet() {
var url = "https://api.smartsheet.com/2.0/sheets/[link ID]"
var headers = {
"Authorization": "Bearer [token]",
"Content-Type": "application/json"
}
var options = {
headers: headers,
method: "GET"
}
var response = UrlFetchApp.fetch(url, options);
var result = JSON.parse(response);
//console.log("result: ", result)
return result.records
}