今すぐお試しください!

製品の詳細Google Search PowerShell Cmdlets を確認して、無償評価版をダウンロード:

今すぐダウンロード

PowerShell でGoogle Search Results データをCSV に落としてみた

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

CData Cmdlets Module for Google Search は、直感的なGoogle Search データ連携を提供する標準cmdlet です。 本記事では、GoogleSearch Cmdlets を使ったサンプルを提供します。

Creating a Connection to Your Google Search Results

To search with a Google custom search engine, you need to set the CustomSearchId and ApiKey connection properties.

To obtain the CustomSearchId property, sign into Google Custom Search Engine and create a new search engine.

To obtain the ApiKey property, you must enable the Custom Search API in the Google API Console.

$conn = Connect-GoogleSearch  -CustomSearchId "$CustomSearchId" -ApiKey "$ApiKey"

Selecting Data

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

Select-GoogleSearch -Connection $conn -Table VideoSearch | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myVideoSearchData.csv -NoTypeInformation

You will notice that we piped the results from Select-GoogleSearch 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.
 
 
ダウンロード