Google Adwords API response parse
- by Yun Ling
I am trying to figure out how to parse the Adword API query response without exceptions and one issue that i came across is that sometimes, the data itself contains comma besides the comma between each column. Say i do a query on Adroup, campaign and impression by using
<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201209">
<selector>
<fields>CampaignName</fields>
<fields>AdgroupName</fields>
<fields>Impressions</fields>
<predicates>
<field>Status</field>
<operator>IN</operator>
<values>ENABLED</values>
<values>PAUSED</values>
</predicates>
</selector>
<reportName>Custom Adgroup Performance Report</reportName>
<reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
<dateRangeType>LAST_7_DAYS</dateRangeType>
<downloadFormat>CSV</downloadFormat>
</reportDefinition>
Since my campaign has comma within the string like below:
"Adroup,Campaign,Impressions, Premiun Beer, Beer, Chicago, 1000"
where the adgroup is "premium beer" and campaign is "Beer,Chicago". that will cause an issue if we parse this information by using comma. Does anyone know how to solve this problem?