Help with Bulk Upload Script / CSV

247 views
Skip to first unread message

Michael Lyjak

unread,
Jan 25, 2020, 7:35:02 PM1/25/20
to Google Ads Scripts Forum
Hello, 

We are attempting to upload a CSV template saved in our Google drive with this script and replacing the value for the CSV. However we very beginner programmers and don't have experience in this field. Can anyone assist with the right script template? Thanks!

var file = DriveApp.getFilesByName("BulkCampaignUpload.csv")
   
.next();
var upload = AdsApp.bulkUploads().newFileUpload(file);
upload
.forCampaignManagement();
upload
.preview();

Google Ads Scripts Forum Advisor

unread,
Jan 27, 2020, 2:15:10 AM1/27/20
to adwords-scripts+apn2wqcoqfbbphd7...@googlegroups.com, adwords-scripts+apn2wqcoqfbbphd7...@googlegroups.co, adwords...@googlegroups.com

Hi Michael,

 

Thank you for reaching out to us.

 

I understand that you're trying to use the bulk upload script to upload a CSV template. However, could you elaborate on what you're trying to accomplish with the script so we could further assist you? In addition, you may also refer to these sample codes using the bulk upload.

 

Regards,

Markie

Google Ads Scripts Team



ref:_00D1U1174p._5001USwzNp:ref

Michael Lyjak

unread,
Jan 27, 2020, 2:19:38 AM1/27/20
to Google Ads Scripts Forum
Hi Markie, 

Yes, I need the script to run daily and upload the CSV / Google Sheet into the Ads account to make necessary changes to campaigns. 

Step 1: Completed template in CSV format in a google sheet
Step 2: Script added to upload the same sheet once a day
Step 3: Adwords reads the file and makes necessary adjustments to campaigns logged in file

Thanks!

Michael Lyjak

unread,
Jan 27, 2020, 2:43:19 AM1/27/20
to Google Ads Scripts Forum
Here is my updated Script, it is running, but now the changes are stuck in pending in the uploads section, how can I get them to automatically apply?

function main() {
  bulkUploadFromGoogleSpreadsheet();
}

function bulkUploadFromGoogleSpreadsheet() {
  // The format of this spreadsheet should match a valid bulk upload template.
  // for the list of supported bulk upload templates.
  var SPREADSHEET_URL = 'SPREADSHEET_URL_GOES_HERE';
  var spreadSheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = spreadSheet.getActiveSheet();

  var upload = AdsApp.bulkUploads().newFileUpload(sheet);
  upload.forCampaignManagement();

  // Use upload.apply() to make changes without previewing.
  upload.preview();
}




On Monday, January 27, 2020 at 2:15:10 AM UTC-5, adsscriptsforumadvisor wrote:

Michael Lyjak

unread,
Jan 27, 2020, 2:48:51 AM1/27/20
to Google Ads Scripts Forum
Jan 27, 2020 2:47:24 AM
Finished successfully
ed_temp:ed_temp_upload.csv
4 successful


Success!

Google Ads Scripts Forum Advisor

unread,
Jan 27, 2020, 4:53:39 AM1/27/20
to adwords-scripts+apn2wqcoqfbbphd7...@googlegroups.com, adwords-scripts+apn2wqcoqfbbphd7...@googlegroups.co, adwords...@googlegroups.com

Hi Michael,

 

Thank you for getting back to me.

 

You can follow this guide when using the bulk upload. Looking on your updated script, I can see that you're still using the preview method. To apply these changes, you can call the upload.apply() method. Once everything is set, you can then schedule the script to run daily by following the steps below:

 

  1. On your Google Ads Account, navigate to Tools & Settings > Scripts
  2. On the “Scripts” page in the "Frequency" column, hover over the frequency value of the script, which is initially blank.
  3. Click on the pencil icon.
  4. You can choose an exact date, a day of the week, or a day of the month. You can also choose the time you'd like your script to run.
  5. Click Save.

 

Hope this helps.

Reply all
Reply to author
Forward
0 new messages