The variable ids is an array with different spreadsheet ids. I wrapped it around the request because I want to do the same thing on multiple spreadsheets, however, once inside the request the id just becomes synchronous and stays as the last element in the ids array. I want to make it so that the id is asynchronous and changes so that I can do the request on multiple ids.
for(var i = 0; i < num; i++) {
var id = ids.slice(i, i+1);
var params = {
spreadsheetId: id,
ranges: ['A3:L'],
includeGridData: true,
};
var request = gapi.client.sheets.spreadsheets.get(branchParams);
request.then(function(response) {
console.log(id);