function getAccounts() {
var masterAccount = AdsApp.currentAccount(),
masterName = masterAccount.getName(),
accountIterator = AdsManagerApp.accounts().get();
while(accountIterator.hasNext()) {
var account = accountIterator.next(),
name = account.getName(),
id = account.getCustomerId();
//for current account, get manager account name + id
//make report for account
}
AdsManagerApp.select(masterAccount);
}
RemarksNow, I don't actually want to get all of the accounts. Ideally I would:
- Define id's of top layer manager accounts
- At the top layer, get all manager accounts with the defined id's. (In other words, I only want to get all accounts of certain manager accounts)
- For each of these manager accounts, get all the accounts.
- For each of these accounts, get the name, id, and to what manager account it belongs.
- Create a report for each account that is not a manager account.
I don't think this is actually possible in the way I described so I would need a creative solution. Hopefully someone will be able to help me out here!
Kind regards,
Seb