Ready to get started?

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

Download Now

PowerShell でGoogle Ads Data データをCSV に落としてみた

標準PowerShell cmdlets を使ってGoogle Ads テーブルにアクセス。

CData Cmdlets Module for Google Ads は、直感的なGoogle Ads データ連携を提供する標準cmdlet です。 本記事では、GoogleAds 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.
 
 
ダウンロード