DISAPPROVED ADS REPORT

663 views
Skip to first unread message

Swan

unread,
Feb 20, 2022, 7:17:35 PM2/20/22
to Google Ads Scripts Forum
Hi .
I want to create a report of disapproved ads on a spreadsheet. I made a script while looking at the help, but it fails with such an error. What is the cause? Please tell me.

InputError: Missing FROM clause: SELECT CampaignName, AdGroupName, Id, CombinedApprovalStatusFROM AD_PERFORMANCE_REPORT WHERE CombinedApprovalStatus = DISAPPROVED and Status in [ENABLED,PAUSED]DURING TODAY (file Code.gs, line 7)

  function main() {
  var spreadsheet = SpreadsheetApp.openById('URL');
  const sheet = spreadsheet.getSheetByName('Approval');
  var report = AdsApp.report(
    'SELECT CampaignName, AdGroupName, Id, CombinedApprovalStatus' +
    'FROM   AD_PERFORMANCE_REPORT ' +
    'WHERE  CombinedApprovalStatus = DISAPPROVED and Status in [ENABLED,PAUSED]' +
    'DURING TODAY');
  report.exportToSheet(sheet);
}

Nils Rooijmans

unread,
Feb 21, 2022, 1:29:09 AM2/21/22
to Google Ads Scripts Forum
your select clause is lacking some spaces; try adding a space before 'FROM" and a space before 'DURING".

Also, if you're interested in a solution to your needs, I created a free script that reports disapproved ads in a Google Sheet and sends an alert.
You can find it here:

Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/

Google Ads Scripts Forum Advisor

unread,
Feb 21, 2022, 2:42:15 AM2/21/22
to adwords...@googlegroups.com

Hello,

 

Thank you for reaching out to the Google Ads script support channel. I’m James, I’ll be assisting you with this.

 

Based on the given query, it appears that there are some issues with the formatting of your query. That said, you didn’t use any spaces between your selector, your FROM clause and your condition. Also, you didn’t include an AND operator and date segmentation on your last filter. Instead, you’ve directly used the DURING operator. Having said that, can you please try the following script converted into GAQL query below and observe if the issue will persist on your end?

function main() {
var spreadsheet = SpreadsheetApp.openByUrl('INSERT_SPREADSHEET_URL_HERE');
var sheet = spreadsheet.getSheetByName(’INSERT_SHEET_NAME_HERE’);
 
var report = AdsApp.report("SELECT campaign.name, ad_group.name, ad_group_ad.ad.id, ad_group_ad.policy_summary.approval_status FROM ad_group_ad WHERE ad_group_ad.policy_summary.approval_status = 'DISAPPROVED' AND ad_group_ad.status IN ('ENABLED', 'PAUSED') AND segments.date DURING TODAY");
 
report.exportToSheet(sheet);
}

For better construction of query. I would suggest that you use this Google Ads Query builder.

 

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WxWxh:ref

Mark Fiore

unread,
Jun 17, 2022, 12:35:20 PM6/17/22
to Google Ads Scripts Forum
Hi Nils,

I tried to use your script but was given this error message below. Any thoughts? I'm beyond new to scripts :)

InputError: CombinedApprovalStatus is an ambiguous field and may refer to one of ad_group_ad.policy_summary.approval_status,ad_group_ad.policy_summary.review_status.
 at new nG (adsapp_compiled:16527:13)
 at new EG (adsapp_compiled:16744:22)
 at rH.report (adsapp_compiled:17406:12)
 at sH.report (adsapp_compiled:17545:21)
 at Object.<anonymous> (adsapp_compiled:18335:54)

Google Ads Scripts Forum Advisor

unread,
Jun 20, 2022, 6:17:54 AM6/20/22
to adwords...@googlegroups.com
Hi Mark,

Could you please share your CID and the script name, so I could check your implementation?

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2WxWxh:ref

Mark Fiore

unread,
Jun 21, 2022, 9:33:44 AM6/21/22
to Google Ads Scripts Forum
Thanks Teejay,

CID is 999-124-0209 and it is the only script in there called 'Disapproved Ad Detector'.

Nils Rooijmans

unread,
Jun 21, 2022, 12:11:24 PM6/21/22
to Google Ads Scripts Forum
Hi All,

I've updated the script to be compatible with the new script environment , GAQL and the new Google Ads API.

Here's the link to the updated version:

- Nils

Mark Fiore

unread,
Jun 21, 2022, 12:29:21 PM6/21/22
to Google Ads Scripts Forum
Hey Nils,

Appreciate it, had a feeling that might have been the issue. However, I'm getting a new error with your updated version. Error below and I included a screenshot of what line is line 46 in mine. Really should be the same across but just to make sure.

SyntaxError: Unexpected token ';' (line 46)


disapproval.png

Nils Rooijmans

unread,
Jun 21, 2022, 12:34:20 PM6/21/22
to Mark Fiore via Google Ads Scripts Forum
fixed, please try again

--
-- 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/NRaOUA-SKho/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/c59568ab-f68b-49bc-8bf8-db92a22100a1n%40googlegroups.com.

Mark Fiore

unread,
Jun 21, 2022, 12:37:34 PM6/21/22
to Google Ads Scripts Forum
Fixed the first but I have a new error.

SyntaxError: Unexpected token ';' (line 92)
disapproval 2.png

Nils Rooijmans

unread,
Jun 21, 2022, 12:58:06 PM6/21/22
to Mark Fiore via Google Ads Scripts Forum
damn typos ;-( please try again

Mark Fiore

unread,
Jun 21, 2022, 2:34:05 PM6/21/22
to Google Ads Scripts Forum
No worries :p Seems to be working just fine now! Well played sir! :D

Thanks!

Mark Fiore

unread,
Jun 21, 2022, 2:39:14 PM6/21/22
to Google Ads Scripts Forum
Just curious, do you have an mcc level version as well?
Reply all
Reply to author
Forward
0 new messages