adding google slidesapi request from loop -
i trying merge google slide-show data spreadsheet.
i go through spreadsheet in loop , replace placeholders. in first version, called batchupdate after every request, this:
for (var k=0;k<data_ids.length;k++) { var searchpattern = '<<'+data_ids[k]+'>>'; var replacement = data_values[k]; var requests = [{ 'replacealltext': { 'containstext': {'text': searchpattern}, 'replacetext': replacement } }]; slides.presentations.batchupdate({'requests': requests}, presentationsid); };
however, overloads api calls. trying put replacealltext-requests 1 request , run single batchupdate @ end:
var requests = []; (var k=0;k<data_ids.length;k++) { var searchpattern = '<<'+data_ids[k]+'>>'; var replacement = data_values[k]; requests.push ({ 'replacealltext': { 'containstext': {'text': searchpattern}, 'replacetext': replacement } }); }; slides.presentations.batchupdate({'requests': requests}, presentationsid);
this not working, , don't know why. requests arrays, not? there different way add request?
Comments
Post a Comment