withCondition end date >= todays date

Skip to first unread message

Krishnadas D

Sep 8, 2021, 6:35:05 AMSep 8
to Google Ads Scripts Forum
i am Iterating  through video campaign in google ads script ,
here i need to get only campaigns that not ended 
so i need some query like 
AdsApp.videoCampaigns().withCondition("end < today").get();

can i do this in script ?

Google Ads Scripts Forum Advisor

Sep 8, 2021, 10:20:57 PMSep 8
to adwords...@googlegroups.com

Thanks for reaching out. Harry here, from the Google Ads Scripts Team.

The withCondition method of the AdsApp.​VideoCampaignSelector does not let you filter entities by their end date and you can use the fields/columns listed in this link instead. What you can do is retrieve the video campaigns, iterate through them, then have an if condition comparing if the value returned by the getEndDate method is less than or equal to today's date. You may also check out the Working with Dates and Times guide in Google Ads scripts. Moreover, I believe you would be better off selecting campaigns that has not ended by filtering them by their status (Eg. withCondition("Status = ENABLED") ).

If you have questions, please let me know.

Google Logo
Harry Cliford Rivera
Google Ads Scripts Team


Krishnadas D

Sep 9, 2021, 2:11:29 AMSep 9
to Google Ads Scripts Forum

thank you 
Reply all
Reply to author
0 new messages