Create Campaign using Google Ads Scripts and Google Sheets

416 views
Skip to first unread message

Andreea Petrea

unread,
Apr 14, 2021, 8:08:31 AM4/14/21
to Google Ads Scripts Forum
Hello,

I want to create some campaigns automatically,  every campaign having an ad group with an ad. 
I stored my campaign info in a Google Sheet(structure attached) and have this Script:
function main() {  
  bulkUploadFromGoogleSpreadsheet();
}

function bulkUploadFromGoogleSpreadsheet() {
  var spreadSheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = spreadSheet.getActiveSheet();
  Logger.log("bulk create");
  var upload = AdsApp.bulkUploads().newFileUpload(sheet);
  upload.forCampaignManagement();
  upload.preview();
}

My code returns no error and also   Logger.log("bulk create");
 is working but I see no change.
Any help, please?
campaignfields.png

Google Ads Scripts Forum Advisor

unread,
Apr 14, 2021, 9:39:40 PM4/14/21
to adwords...@googlegroups.com

Hello Andreea,

Thank you for reaching out to us. This is Mark and I'll be assisting you with this.

The reason why there is still no change when running your code is because you're still uploading in preview mode ( upload.preview() ). You can see those pending actions under TOOLS & SETTINGS > BULK ACTIONS > Uploads. You can then select the Apply under Actions column.

To apply those changes programmatically, you can use the upload.apply() instead of the upload.preview().

Hope this helps.

Regards,

Google Logo
Mark Kevin Albios
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2FYRGo:ref

Andreea Petrea

unread,
Apr 15, 2021, 1:59:38 AM4/15/21
to Google Ads Scripts Forum
I receive these errors even if my Start date is 2021-10-06 and End date is 2021-10-20
The value '2021-00-05' in column 'Start Date' is invalid.
The value '2021-00-19' in column 'End Date' is invalid.

Andreea Petrea

unread,
Apr 15, 2021, 4:21:35 AM4/15/21
to Google Ads Scripts Forum
I found the answer. I had to make the date cells to be Format-->Number-->Plain text

Google Ads Scripts Forum Advisor

unread,
Apr 15, 2021, 4:30:31 AM4/15/21
to adwords...@googlegroups.com
Hi Andreea,

Thanks for coming back. Harry, teammate of Mark on the Google Ads Scripts Team. Allow me to assist you this time.

The error you are encountering is usually caused by the script reading the date values from the Google Sheet as a different data type. Kindly try changing the format of the column values for the Start Date and End Date to plain text. Highlight the cell and navigate to Format > Number and select Plain Text, then kindly re-run your script.

Let me know how it goes after trying or if you have other concerns.


Thanks, 
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2FYRGo:ref

Andreea Petrea

unread,
Apr 15, 2021, 4:35:58 AM4/15/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hi,

It is working perfectly.
I am trying to make baby steps for automatically generating a campaign with ad group, ad and keywords. But is it there any way to generate it using a single Google Sheet for the entire setup, or I will need 4 Google Sheets?

Thank you,
Andreea 

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/uGCFtqmlrck/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/TzYw-000000000000000000000000000000000000000000000QRLJMQ008jBebhroSuaK1nsQCxlv2A%40sfdc.net.

Google Ads Scripts Forum Advisor

unread,
Apr 15, 2021, 5:49:37 AM4/15/21
to adwords...@googlegroups.com
Hi Andreea,

Yes, you would need to have seperate sheets for each of the entities you would like automatically generate through Bulk Uploads. Let me know if you have other concerns. I would be happy to assist.
Reply all
Reply to author
Forward
0 new messages