Parsing error. Please check your selector. (file Code.gs, line 25)

408 views
Skip to first unread message
Message has been deleted

Giny

unread,
Mar 1, 2019, 5:57:13 AM3/1/19
to Google Ads Scripts Forum
Hi there,

I encountered the error - Parsing error. Please check your selector. (file Code.gs, line 25). Yet, I don't know why my code has error.
I found that many people said this is due to the mistake made in the query.
Yet, I am new to Google Ads Script and don't know much about programming...
Please forgive my ignorance and it would be grateful if anyone could help.
Here is my code:

function main() {

// The start and end date of the date range
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
var now = new Date();
var from = new Date(now.getTime() - MILLIS_PER_DAY);
var to = new Date(); - MILLIS_PER_DAY;
var timeZone = AdWordsApp.currentAccount().getTimeZone();

// Add you spreadsheet here

// Select Query - note the and conditions to remove strings such as ">90%", "<10%" and "--" --> remove when editing the query in PBI
var query = 'SELECT Date, CampaignName, AdGroupName, KeywordText, Impressions, Clicks, Conversions, AveragePosition' +
'FROM KEYWORDS_PERFORMANCE_REPORT ' +
'WHERE AdNetworkType2 = SEARCH AND CampaignStatus = ENABLED AND AdGroupStatus = ENABLED' +
'DURING ' + Utilities.formatDate(from, timeZone, 'yyyyMMdd') + ','
+ Utilities.formatDate(to, timeZone, 'yyyyMMdd');

// Check timezone. If you don't want to use account timezone you can change it
// Logger.log(Utilities.formatDate(date, 'Etc/GMT', 'yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\''));
Logger.log(Utilities.formatDate(to, timeZone, 'yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\''));

Logger.log(query);
var report = AdWordsApp.report(query);

report.exportToSheet(spreadsheet.getActiveSheet());
Logger.log("Your Spreadsheet is ready " + spreadsheet.getUrl());
}



Thanks and regards,
Giny

googleadsscrip...@google.com

unread,
Mar 1, 2019, 9:31:50 AM3/1/19
to Giny via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi Giny,

You will need to add a space after AdGroupStatus = ENABLED. Because you don't, your current query will be AdGroupStatus = ENABLEDDURING instead of AdGroupStatus = ENABLED DURING.

Let me know if you face any other issues.

Cheers,
Anthony
Google Ads Scripts Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- 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-scripts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/831a50f6-ef54-4f9f-abba-7ac6f7189771%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Giny

unread,
Mar 3, 2019, 10:57:44 PM3/3/19
to Google Ads Scripts Forum
Hi Anthony,

The same issue still occurs after adding a space after  AdGroupStatus = ENABLED:
Parsing error. Please check your selector. (file Code.gs, line 25)
Is there any other error I need to fix?

Thanks and regards,
Giny


On Friday, 1 March 2019 22:31:50 UTC+8, googleadsscripts-forumadvisor wrote:
Hi Giny,

You will need to add a space after AdGroupStatus = ENABLED. Because you don't, your current query will be AdGroupStatus = ENABLEDDURING instead of AdGroupStatus = ENABLED DURING.

Let me know if you face any other issues.

Cheers,
Anthony
Google Ads Scripts Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

googleadsscrip...@google.com

unread,
Mar 4, 2019, 9:43:56 AM3/4/19
to Giny via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi Giny,

You will also need to add a space after AveragePosition. You will also need to replace KeywordText with Criteria since it is no longer a supported field.

Cheers,
Anthony
Google Ads Scripts Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Giny

unread,
Mar 19, 2019, 4:17:11 AM3/19/19
to Google Ads Scripts Forum
Thanks a lot for your help, Anthony.
It works now.


On Monday, 4 March 2019 22:43:56 UTC+8, googleadsscripts-forumadvisor wrote:
Hi Giny,

You will also need to add a space after AveragePosition. You will also need to replace KeywordText with Criteria since it is no longer a supported field.

Cheers,
Anthony
Google Ads Scripts Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages