Hello,
I am struggling to convert an Account Performance Report into a CSVFOREXCEL. I've tried using both report_downloader.DownloadReport and report_downloader.DownloadReportWithAWQL.
I have been using the code examples from the Documentation:
# Create report query.
report_query = (adwords.ReportQueryBuilder()
.Select('CampaignId', 'AdGroupId', 'Id', 'Criteria',
'CriteriaType', 'FinalUrls', 'Impressions', 'Clicks',
'Cost')
.From('CRITERIA_PERFORMANCE_REPORT')
.Where('Status').In('ENABLED', 'PAUSED')
.During('LAST_7_DAYS')
.Build())
# You can provide a file object to write the output to. For this
# demonstration we use sys.stdout to write the report to the screen.
report_downloader.DownloadReportWithAwql(
report_query, 'CSV', sys.stdout, skip_report_header=False,
skip_column_header=False, skip_report_summary=False,
include_zero_impressions=True)
However, when I change the download type from CSV to CSVFOREXCEL, I begin to get this error:
'UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte'
Also, when I try providing a file object PATH
PATH = r'C:\Users\morehek\intraday.csv'
in the place of sys.stdout, I receive errors that I cannot write the output to a string object.
Can someone on the Adwords team please advise me on how to cleanly write a report download into a Microsoft Excel CSV?
Thanks
-Matt