TypeError: Cannot call method "getValues" of null. - when running a manager account script.

291 views
Skip to first unread message

joysdepraved

unread,
Jun 28, 2017, 9:16:34 AM6/28/17
to AdWords Scripts Forum
We have a master account with multiple client accounts to which campaigns I need to apply a list of negative keywords.Therefore I decided that this script would do. 

Following the instructions I created this spreadsheet and added my email and the negative keywords list name in columns C4 and C6.

Then I replaced the example string in the script  so from this : 
var SPREADSHEET_URL = 'INSERT_SPREADSHEET_URL_HERE';
I changed it to this :

Then I ran the script in preview mode, but unfortunately I got the error mentioned in the title - TypeError: Cannot call method "getValues" of null. (line 481)

On line 481 I have this line of code :
var values = spreadsheet.getRangeByName('ConfigurationValues').getValues();

I don't see why would getValues return null, as I have typed my email and the list's name in the sheet.

I don't think it matters, but I created the sheet from a different account than the one I use for adwords. The sheet is public and everyone can edit.

Can anyone help?

Anthony Madrigal

unread,
Jun 28, 2017, 9:20:07 AM6/28/17
to AdWords Scripts Forum
Hello,

When creating the spreadsheet, you will need to make a copy of the template by File -> Make a copy. Once you have the copy of the spreadsheet, you will need to configure the Keywords and Placements tabs with the negative values you would like in your master lists.

Please let me know if you have any other issues.

Cheers,
Anthony
AdWords Scripts Team

joysdepraved

unread,
Jun 28, 2017, 9:49:15 AM6/28/17
to AdWords Scripts Forum
Hello, Anthony and thanks for your reply.

After doing what you reccomended the error disappeared, but now I am getting a different one : Selector was too large. Cannot call executeInParallel on a selector with more than 50 elements.

I guess this is because we have under our master account we have 40+ client accounts and a total of 200+ campaigns. Do you have any tips on how can I make the script work for all of our accounts.

Finally, I will need one last clarification regarding the copied sheet - it is not clear to me if I should type just a name of a negative keyword list  which's already in the shared library or I will have to type a negative keyword list name + the negative keywords themselves. Can you clarify this as well?
Message has been deleted
Message has been deleted

Anthony Madrigal

unread,
Jun 28, 2017, 10:42:26 AM6/28/17
to AdWords Scripts Forum
Hello,

That is correct. There is a 50 account limit when running MCC level scripts. What I suggest is adding multiple versions of the script in your account, each handling a certain set of client accounts.

You could either
  • Specify the account IDs in your spreadsheet
  • Or apply account labels to groups of accounts and make the following change:
function main() {
 
var config = readConfig();

 
var accountSelector = MccApp.accounts().withCondition("LabelNames CONTAINS 'Group A'");

  accountSelector
.executeInParallel('processAccounts', 'postProcess');
}

The way the script works is that it creates negative keyword lists with the name you specify and the keywords you list in the Keywords tab in the spreadsheet. 

Regards,
Anthony
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages