Ready to get started?

Learn more about the Google AdWords PowerShell Cmdlets or download a free trial:

Download Now

Pipe Google Ads Data to CSV in PowerShell

Use standard PowerShell cmdlets to access Google Ads tables.

The CData Cmdlets Module for Google Ads is a standard PowerShell module offering straightforward integration with Google Ads. Below, you will find examples of using our GoogleAds Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Google Ads Data

Google uses the OAuth authentication standard. To access Google APIs on behalf on individual users, you can use the embedded credentials or you can register your own OAuth app.

OAuth also enables you to use a service account to connect on behalf of users in a Google Apps domain. To authenticate with a service account, you will need to register an application to obtain the OAuth JWT values.

In addition to the OAuth values, specify the DeveloperToken and ClientCustomerId.

See the "Getting Started" chapter of the help documentation for a guide to using OAuth.

$conn = Connect-GAds  -DeveloperToken "$DeveloperToken" -ClientCustomerId "$ClientCustomerId"

Selecting Data

Follow the steps below to retrieve data from the CampaignPerformance table and pipe the result into to a CSV file:

Select-GoogleAds -Connection $conn -Table CampaignPerformance | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myCampaignPerformanceData.csv -NoTypeInformation

You will notice that we piped the results from Select-GoogleAds into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.