function main() {
// The format of this spreadsheet should match a valid bulk upload template.
// for the list of supported bulk upload templates.
var spreadSheet = SpreadsheetApp.openById("spreadsheet ID")
var sheet = spreadSheet.getSheetByName("sheetname")
var lastRowOnTheSheet = sheet.getLastRow()
var rangeWithBids = sheet.getRange("A2:"+lastRowOnTheSheet).getValues()
//the [1] gets me just the first row
Logger.log(rangeWithBids)
for(i=1; i<rangeWithBids.length; i++) {
var campaign = rangeWithBids[i][0];
var ad_group = rangeWithBids[i][1];
var targetCpa = rangeWithBids[i][2];
AdWordsApp.adGroups().withCondition("CampaignName = '"+campaign+"'").withCondition("Name = '"+ad_group+"'").get().next().bidding().setCpa(targetCpa);
}
Logger.log('script finished')
}
Not that this is very slow and it takes about 20 minutes to update 2500 adgroups. Pretty sure the script could use some help with making it faster.
DZ