How to create a google ads campaign with google ads scripts

877 views
Skip to first unread message

George Orfanidis

unread,
Jun 20, 2020, 7:02:12 PM6/20/20
to Google Ads Scripts Forum

Hello everybody,

I am trying to create a new campaign with the following google script provided by google ads. However, when I run the code nothing happens and no campaign is created. Any help will be much appreciated. Thanks in advance, George 

function createOrUpdateCampaigns() {
 
// See https://developers.google.com/google-ads/scripts/docs/features/bulk-upload
 
// for the list of supported bulk upload templates and their column names.
 
var columns = [
   
'Campaign', 'Budget', 'Bid Strategy type', 'Campaign type'
 
];

 
var upload = AdsApp.bulkUploads().newCsvUpload(
      columns
, {moneyInMicros: false});

 
// Google Ads identify existing campaigns using its name. To create a new
 
// campaign, use a campaign name that doesn't exist in your account.
  upload
.append({
   
'Campaign': 'Test Campaign 1',
   
'Budget': 234,
   
'Bid Strategy type': 'cpc',
   
'Campaign type': 'Search Only'
 
});
 
// Use upload.apply() to make changes without previewing.
  upload
.preview();
}

Google Ads Scripts Forum Advisor

unread,
Jun 21, 2020, 9:44:34 PM6/21/20
to adwords...@googlegroups.com
Hi George,

Thanks for posting your concern.

I can see that the preview() method has been implemented in your code. This method is use to upload changes in preview mode or the changes will not automatically apply so that you can review it after the script executed. You will not see the simulated result in the SCRIPT HISTORY tab, instead, you can see/review it here TOOLS & SETTINGS > BULK ACTIONS > Uploads. Then, you can choose on this view either you apply or discard the changes.

However, if you want the script to apply the changes right after it finished the execution, then you can remove the comment of the line upload.apply() and comment the upload.preview().

Let me know if you have questions/clarification with the provided suggestion.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5004Q218AHq:ref
Reply all
Reply to author
Forward
0 new messages