AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

4.4K members online now
4.4K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me

"Empty" label from a script

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there.

I'm working on a script to automate some tasks: to get all my adgroups labeled every week according to data from an external spreedsheet.

I managed to get that part working just fine. 

But I still have to some tedious manual work before running the script: to remove all adgroups associated with each of the labels I'm using in the script, because if not, any of them may get more than one label, which would defeat the purpose of my script.

Could I do that programatically?


I tried iterating through all the adgroups and deleting the label(s), but they are just too many adgroups  so it times out



 function removeLabel() {
var adgroupIterator = AdWordsApp.adGroups().withCondition('Status = "ENABLED"').get();
while (adgroupIterator.hasNext()) {
var adgroup =;
adgroup.removeLabel('example', 'of', 'different', 'labelnames');



TL;DR: Is there a way to remove some labels from all the adgroups it is applied without iterating through all adgroups?



1 Expert replyverified_user

"Empty" label from a script

Top Contributor
# 2
Top Contributor

If you are getting time-outs I would recommend using the Adwords API which is more powerful. Takes just a couple hours to setup and get your token, but should solve your problem. You would need to know a language other than JS though.

Jim Vaillancourt, AdWords Top Contributor, LinkedIn
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.