Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →How to pipe Google Search Results to CSV in PowerShell
Use standard PowerShell cmdlets to access Google Search tables.
The CData Cmdlets Module for Google Search is a standard PowerShell module offering straightforward integration with Google Search. Below, you will find examples of using our GoogleSearch Cmdlets with native PowerShell 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.