Googel Adwords API - Reporting - (ParallelReportDownload.php) need the data in an array format

411 views
Skip to first unread message

Pradeep Kumar

unread,
Sep 8, 2017, 10:43:15 AM9/8/17
to AdWords API Forum
Hi Everyone,

This is Pradeep ( Web Programmer - PHP ). I am using google adwords api to get campaigns reports. While i am accessing the reports from ParallelReportDownload.php then i can see the report is being downloaded into excel format.

I don't want an report to be download. I want the result in an array format after searching a lot on google.com i found a method which is getAsString() that is returning the result in a string format it is not useful for me till now.

Can you please help me to fix this issues.

Thank  You

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Sep 8, 2017, 3:17:40 PM9/8/17
to AdWords API Forum
Hi Pradeep,

The API only supports these formats in which the report data can be downloaded. You will need to post process the result to convert the data into your desired format. As you found out, the PHP client library supports the methods getStream() (gets the report download response as a stream), getAsString() (gets the report download response as a string) and saveToFile($filePath) (writes the contents of the report download response to the specified file). You could look into the options of using any of these methods to handle the report output. What issue are you facing while using the getAsString()?

Thanks,
Sreelakshmi, AdWords API Team

Pradeep Kumar

unread,
Sep 9, 2017, 9:14:38 AM9/9/17
to AdWords API Forum
Hi Sreelakshmi,

Thank you for the help. My previous issue is resolved. 

I am stuck some where else right now.

AS you see in the code section 

$reportDefinition->setDateRangeType(
        ReportDefinitionDateRangeType:: LAST_7_DAYS);

I created a variable name $date which is having value LAST_7_DAYS

When i call it as mentioned below it will display an error

Code : 

$reportDefinition->setDateRangeType(
        ReportDefinitionDateRangeType:: $_GET['date']);


Error : 
 

Fatal error: Uncaught Error: Access to undeclared static property: Google\AdsApi\AdWords\Reporting\v201609\ReportDefinitionDateRangeType::$_GET in E:\server\htdocs\adwards\examples\AdWords\v201609\Reporting\CampaignsPerformancereport.php:81 Stack trace: #0 E:\server\htdocs\adwards\examples\AdWords\v201609\Reporting\CampaignsPerformancereport.php(230): Google\AdsApi\Examples\AdWords\v201609\Reporting\ParallelReportDownload::runExample(Object(Google\AdsApi\AdWords\AdWordsServices), Object(Google\AdsApi\AdWords\AdWordsSessionBuilder), 'C:\\Users\\Tech\\A...') #1 E:\server\htdocs\adwards\examples\AdWords\v201609\Reporting\CampaignsPerformancereport.php(234): Google\AdsApi\Examples\AdWords\v201609\Reporting\ParallelReportDownload::main() #2 {main} thrown in E:\server\htdocs\adwards\examples\AdWords\v201609\Reporting\CampaignsPerformancereport.php on line 81


Kindly help me to FIX.

Pradeep Kumar

unread,
Sep 9, 2017, 9:18:05 AM9/9/17
to AdWords API Forum
Also with that i also want to filter report via 

Geo (location)

Device


Help me out with this also.


On Friday, September 8, 2017 at 8:13:15 PM UTC+5:30, Pradeep Kumar wrote:

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Sep 11, 2017, 11:36:00 AM9/11/17
to AdWords API Forum
Hi Pradeep, 

Since your latest question is unrelated to original issue on this thread, could you please create a new forum thread? This is to help us keep better track of the issues.
Reply all
Reply to author
Forward
0 new messages