Bulk Upload Campaign Creation Not Working

1,140 views
Skip to first unread message

Brandon Scholting

unread,
Feb 17, 2022, 7:33:19 PM2/17/22
to Google Ads Scripts Forum
Hello, 

I tried posting a question on this over an hour ago and it hasn't showed up at all. But for the past year, my organization has been using the script below to create search campaigns. This script has ran thousands of times over that year without any issues until yesterday. The script continues to run without any errors, but the campaigns simply do not show up and the applicable accounts don't have any records of bulk uploads. Is there something I am missing? As you can see in the function below, I have logged the various pieces of information that the script is pulling from the spreadsheet to ensure that the script  is indeed making them into variables. Thanks!

function createCampaigns(){
 
  var spreadsheetUrl = '...';
  var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl);
  var sheet = spreadsheet.getSheetByName('...');
  var num = sheet.getRange("CF2").getValue();
 
 
  if(num>0) {
   
  var data = sheet.getRange(6,79,num,8).getValues();

for (i=0 ; i<num ; i++){
    var row = data[i];
 
    var uploadCode = row[7];
 
    if(uploadCode>0){
 
    var rowNumber = row[5];
      //Logger.log(rowNumber);
    var accountID = row[0];
      //Logger.log(accountID);
    var campaignName = row[1];
      //Logger.log(campaignName);
    var budgetAmount = row[3];
      //Logger.log(budgetAmount);
    var bidStrat = row[4];
      //Logger.log(bidStrat);
    var campStatus = row[2];
      //Logger.log(campStatus);

    var account_iter = AdsManagerApp.accounts()
      .withIds([accountID])
      .get();

    while (account_iter.hasNext()){
     
      var account = account_iter.next();
      var accountName = account.getName();
      AdsManagerApp.select(account);
     
     
            try {
     
      var campaign_iter = AdsApp.campaigns()
        .withCondition("Name = '" + campaignName + "'")
        .get();
     
      while (campaign_iter.hasNext()){
        var campaign = campaign_iter.next();
       
        var name = campaign.getName();
        var campID = campaign.getId();
       
        sheet.getRange(rowNumber, 87, 1, 1).setValue(campID);
        removeUploadedCampaigns();
      }
      }
      catch(e) {
        Logger.log(e);
      }    
     
     
     
      var columns = [
   "Campaign", "Budget", "Bid Strategy type", "Campaign type", "Campaign status", "Currency code", "Budget type", "Status", "Customer ID", "Campaign subtype"
    ];

  var upload = AdsApp.bulkUploads().newCsvUpload(columns);

  upload.append({
   "Campaign": campaignName,
   "Budget": budgetAmount,
   "Bid Strategy type": bidStrat,
   "Campaign type": "Search Only",
   "Campaign status": campStatus,
   "Currency code": "USD",
   "Budget type": "Daily",
   "Status": campStatus,
   "Customer ID": accountID,
   "Campaign subtype": "Standard"

  });
     //Logger.log(campaignName);
  upload.forCampaignManagement();
  upload.apply();  
     
      try {
     
      var campaign_iter = AdsApp.campaigns()
        .withCondition("Name = '" + campaignName + "'")
        .get();
     
      while (campaign_iter.hasNext()){
        var campaign = campaign_iter.next();
       
        var name = campaign.getName();
        var campID = campaign.getId();
       
        sheet.getRange(rowNumber, 87, 1, 1).setValue(campID);
        removeUploadedCampaigns();
      }
      }
      catch(e) {
        Logger.log(e);
      }              
        }
      }
    }
    var campUpComp = sheet.getRange("F2").getValue();
    Logger.log(campUpComp);
   }
  else {
    var NoCamp = sheet.getRange("F3").getValue();
    Logger.log(NoCamp);
  }
  }

Google Ads Scripts Forum Advisor

unread,
Feb 17, 2022, 10:51:55 PM2/17/22
to adwords...@googlegroups.com
Hello Brandon,

Thank you for reaching out to us.

For us to have a closer look, could you please provide the following details via Reply privately to author option?
  • CID
  • Script Name
  • Shareable link of the spreadsheet being used in the script
In case you encounter an error when using the mentioned option, you can send the requested information on this email (googleadsscr...@google.com) instead, then let us know here once sent.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WwsZl:ref

Brandon Scholting

unread,
Feb 18, 2022, 8:33:31 AM2/18/22
to Google Ads Scripts Forum
Thank you for your response and help! I have responded with the requested information via the email provided, because it said that I did not have permission to reply privately to the author.

On Thursday, February 17, 2022 at 9:51:55 PM UTC-6 adsscripts wrote:
Hello Brandon,

Thank you for reaching out to us.

For us to have a closer look, could you please provide the following details via Reply privately to author option?
  • CID
  • Script Name
  • Shareable link of the spreadsheet being used in the script
In case you encounter an error when using the mentioned option, you can send the requested information on this email (googleadsscripts-support@google.com) instead, then let us know here once sent.

Google Ads Scripts Forum Advisor

unread,
Feb 22, 2022, 3:05:18 AM2/22/22
to adwords...@googlegroups.com
Hi Brandon,

Thank you for providing the requested information. As per checking, it appears that the script in question is getting an error while mutating sitelinks. The team is currently working on to update Google Ads Scripts to support asset-based extensions. I humbly ask for your continued patience and be on the lookout for new updates and releases in scripts through our blog in the meantime.

Brandon Scholting

unread,
Feb 22, 2022, 5:41:14 PM2/22/22
to Google Ads Scripts Forum
Hello and thank you for your response!

I do realize that there was an error with the sitelink function due to the issue that you outlined above. However, that was not the primary point in my question, which was more oriented around the scripts not bulk uploading new campaigns despite the script running without errors. Are these two issues linked somehow? Thanks!

Google Ads Scripts Forum Advisor

unread,
Feb 23, 2022, 9:03:00 PM2/23/22
to adwords...@googlegroups.com

Hello Brandon,

Thanks for getting back to us.

Looking back on your script (Text Ads Generator - v.5.3), I've checked its script history and there has been a couple of successful runs and failures. On its last run, it was a success; however, its previous run encountered an error due to what my colleague (Teejay) mentioned which is related to sitelinks. In your script, the creation of those sitelinks are called in the latter part and shouldn't affect the creation of those campaigns. For us to further check, can you share to us those campaigns that aren't created even though the script runs successfully?

Regards,

Google Logo
Mark Kevin
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WwsZl:ref

Brandon Scholting

unread,
Feb 23, 2022, 9:17:43 PM2/23/22
to Google Ads Scripts Forum on behalf of adsscripts
Hi Mark,

Thank you for your response!

There are 11 campaigns with 18 ads that are queued and ready for upload with the script in question since the 18th on the spreadsheet with the link that I privately sent Google Ads Script support titled Google Ads Text Ads Generator v.5.3 in the "GENERATED ADS" tab. Since then, the script has successfully run dozens of times, but it still won't upload the campaigns. The list that you see when first opening the tab is the queue of ads to be uploaded, but farther to the right in columns that were previously hidden is the queue for actually uploading campaigns (columns CA:CH). The spreadsheet/script system is designed so that the script will iterate through the list/queue of campaigns to be uploaded and for each row will first attempt to find a campaign by that name in the selected account and if there is not already a campaign by that name in the account, it should create one then enter the campaign ID into the correct row of the spreadsheet and call a different function to remove that specific campaign from the queue. Thank you for your help!

Brandon

--
-- 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 the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/f4rY3000000000000000000000000000000000000000000000R7SDOU00bh86Dil9QFCdTOtVmYAOOg%40sfdc.net.


--
Brandon Scholting
Product Engineer

Phone: 402.968.3630
Email: Brandon.Scholting@RentVision.com
Website: www.RentVision.com

RentVision-150

Google Ads Scripts Forum Advisor

unread,
Mar 1, 2022, 5:14:13 AM3/1/22
to adwords...@googlegroups.com

Hello Brandon,

Thank you for your patience. I’m James, also a member of the Google Ads Script support team. Allow me to assist you further.

Can you please point out or highlight those campaigns within your spreadsheet that were not being uploaded to your Google Ads account so that we can have a clear and better visibility of the issue? You may also include some screenshots for our investigations.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WwsZl:ref

Brandon Scholting

unread,
Mar 1, 2022, 9:37:13 AM3/1/22
to Google Ads Scripts Forum
Hi James,

In a word, all of the campaigns on the spreadsheet should be uploaded. Thanks!
Screen Shot 2022-03-01 at 8.35.57 AM.png

Google Ads Scripts Forum Advisor

unread,
Mar 3, 2022, 4:14:47 AM3/3/22
to adwords...@googlegroups.com
Hi Brandon,

Thank you for getting back to us. 

I've scrutinized the script especially the createCampaigns function which handle uploading your campaigns from the spreadsheet. The is uploading the following field:
  • Campaign    
  • Budget    
  • Bid Strategy type    
  • Campaign type    
  • Campaign status    
  • Currency code    
  • Budget type    
  • Status    
  • Customer ID    
  • Campaign subtype
I've compared it with our Bulk upload - supported entities, and it appears that there's other field that were missing/not included while uploading which causes the issue. I also check the all bulk actions tab and can confirm that there's an error on your bulk upload. With this, I would recommend checking our bulk upload entities document and make sure that the field which were tag as required are included on your bulk upload script.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WwsZl:ref

Brandon Scholting

unread,
Mar 3, 2022, 10:03:15 AM3/3/22
to Google Ads Scripts Forum
Hi Teejay,

I have modified the createCampaigns function to include every single field that is listed as an entity in from the Bulk upload - supported entities page that you shared (see attached screenshot) and the script still doesn't work at all. 

Screen Shot 2022-03-03 at 9.02.33 AM.png

Google Ads Scripts Forum Advisor

unread,
Mar 8, 2022, 3:26:06 AM3/8/22
to adwords...@googlegroups.com
Hi Brandon,

Thank you for getting back to us.

I've checked your account, and can see that there's still an error on your bulk upload. Since your script is using bulk upload, its result will appear on the All bulk action tab. You may download the error result from there. Below is the error of your bulk upload:

The value 'Mon Mar 07 22:00:00 GMT-08:00 2022' in column 'Start Date' is invalid.;The value 'Thu Mar 04 22:00:00 GMT-08:00 2032' in column 'End Date' is invalid.

I attached the screenshot of the result for your reference. Based on the error, I would recommend to check the data that you were trying to upload specifically the start and end date.
bulk upload error CSV.png

Brandon Scholting

unread,
Mar 8, 2022, 11:22:15 AM3/8/22
to Google Ads Scripts Forum
Hi Teejay,

Thank you for your response! I did have a variable error in the script where the correctly formatted date was not being used. This has been corrected and the script now produces the start and end dates as demonstrated by the script log (see "Script Formatted Dates" screenshot). However, the script still does not work, and I can't get Google Ads to even produce an upload entry (with presumable errors) for the script. Next, I tried downloading the data to be uploaded as a CSV (see "File for CSV manual upload" screenshoot) and manually uploading that file through Google Ads and this also did not work, although it did produce an uploads entry with an extremely ambiguous error (see "Manual CSV Upload Error" screenshot). Finally, I took this exact same CSV and tried uploading it via Google Ads Editor and it was successful (see "Successful manual import of campaigns into Ads Editor" screenshot). I may be wrong, but does all of this not imply an issue with bulk uploads on the Google Ads side of things? Thank you!

File for CSV manaual upload.png
Successful manual import of campaigns into Ads Editor.png
Script Formatted Dates.png
Manual CSV Upload Error.png

Google Ads Scripts Forum Advisor

unread,
Mar 9, 2022, 4:58:12 AM3/9/22
to adwords...@googlegroups.com
Hi Brandon,

Thank you for sharing your investigation findings.

Could you please share the raw CSV file that you manually upload via Reply privately to author option? In case you encounter an error when using the mentioned option, you can send the requested information on this email (googleadsscr...@google.com) instead, then let us know here once sent.

Brandon Scholting

unread,
Mar 9, 2022, 9:35:10 AM3/9/22
to Google Ads Scripts Forum
Hi Teejay,

I have sent an email to the address given above with the requested CSV and the downloaded results produced when the script attempts to upload the data in that CSV. The actual data in the CSV is slightly different from what I showed you yesterday, but I have verified that the script still fails to upload the data but uploading it through Google Ads Editor still works flawlessly. Thanks!


On Wednesday, March 9, 2022 at 3:58:12 AM UTC-6 adsscripts wrote:
Hi Brandon,

Thank you for sharing your investigation findings.

Could you please share the raw CSV file that you manually upload via Reply privately to author option? In case you encounter an error when using the mentioned option, you can send the requested information on this email (googleadsscripts-support@google.com) instead, then let us know here once sent.

Google Ads Scripts Forum Advisor

unread,
Mar 10, 2022, 5:58:18 AM3/10/22
to adwords...@googlegroups.com
Hi Brandon,

Thank you for getting back to us.

I've tried to upload the CSV that you provided on my end, and I'm getting a "Cannot set date to the past" error. This is the same error that were showing on your account. However, I can confirm that the date is right, so it's odd that you were getting this kind of error. Also, you were able to upload the said CSV file directly to the ads editor without any issue. That said, I'll be raising this (including the reports and discussion thus far) to the rest of the team for further investigation. I'll update this thread the soonest they provide their feedback.

Brandon Scholting

unread,
Mar 10, 2022, 8:40:52 AM3/10/22
to Google Ads Scripts Forum
Thank you Teejay!

Brandon Scholting

unread,
May 3, 2022, 7:05:27 AM5/3/22
to Google Ads Scripts Forum
Hello,

It has been over a month and a half since there was any correspondence on this issue. Is there any update on what is causing the issue? Thanks!

Google Ads Scripts Forum Advisor

unread,
May 5, 2022, 3:36:48 AM5/5/22
to adwords...@googlegroups.com

Hello Brandon,

I’m James, also a member of the Google Ads scripts support team. Thank you for your patience on this.

I understand the inconvenience that this might have caused you on your end and apologize that this issue has been taking a while to be resolved. However, I assure you that we are doing everything in our ability to fix all the pending issues on our end. I'm afraid that I cannot share any specific timeline but we appreciate your continued patience on this. Rest assured that I will follow up this with the team and we will update this thread once we have received any feedback from the team.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WwsZl:ref

Google Ads Scripts Forum Advisor

unread,
Jul 19, 2022, 4:38:49 AM7/19/22
to adwords...@googlegroups.com

Hello Brandon,

We appreciate your patience on this and apologize for the delay. I got feedback from the team, see their actual response below:

You can't set a campaign end date in the past. Maybe Editor is doing something that moves the end date if you make this mistake; I don't know about editor. But if they tried using bulk uploads without scripts they would get the same error.

Let me know if you have any further comments.

Regards,

Reply all
Reply to author
Forward
0 new messages