How could I custom a daterange in this script?

10 views
Skip to first unread message

yl...@pangeare.com

unread,
Nov 21, 2018, 12:41:24 PM11/21/18
to AdWords API and Google Ads API Forum
report_downloader = client.GetReportDownloader(version='v201809')
 
# Create report query.
report_query
= (adwords.ReportQueryBuilder()
                 
.Select('Id,Date')
                 
.From('KEYWORDS_PERFORMANCE_REPORT')
                 
.Where('CampaignStatus').In('ENABLED', 'PAUSED')
                 
.During('LAST_7_DAYS')
                 
.Build())
results
=report_downloader.DownloadReportAsStringWithAwql( report_query, 'CSV', skip_report_header=True, skip_column_header=True,skip_report_summary=True, include_zero_impressions=True)

I am using this script to download keywords performance report, what should I do if I would like to download the last 3 months?

Dannison Yao (AdWords API Team)

unread,
Nov 21, 2018, 3:07:53 PM11/21/18
to AdWords API and Google Ads API Forum
Hi Yang, 

You can use the custom date range when you want to retrieve the data you had for the last three months. You may refer to the sample code below:

.During(start_date='<enter_start_date_here>', end_date='<enter_end_date_here>')

Note that the values for start date and end date should be in the format YYYYMMDD. You may also visit this link for more information.

Regards,
Dannison
AdWords API Team
Reply all
Reply to author
Forward
0 new messages