google-ads-apigoogle-ads-script

How do I bulk enable Google Ads campaigns using Google Ads script?


I have 700+ campaigns that I want to enable in a Google Ads account. How can I achieve that using Google Ads script?


Solution

  • Here is a Google Ads script that takes an array of campaign IDs and enables all the campaigns:

    function enableCampaigns(campaignIds) {
        var campaignIterator = AdsApp.campaigns().withIds(campaignIds).get();
        while (campaignIterator.hasNext()) {
            var campaign = campaignIterator.next();
            campaign.enable();
            Logger.log("Campaign '" + campaign.getName() + "' with ID " +
            campaign.getId() + " has been enabled.");
        }
    }
    
    
    function main() {
        var campaignIds = ['REPLACE THIS WITH THE CAMPAIGN ID', 'REPLACE THIS WITH THE CAMPAIGN ID', ...];
        enableCampaigns(campaignIds);
    
    }