Ready to get started?

Learn more about the Bing Search PowerShell Cmdlets or download a free trial:

Download Now

Pipe Bing Search Results to CSV in PowerShell

Use standard PowerShell cmdlets to access Bing Search tables.

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

Creating a Connection to Your Bing Search Results

To connect to Bing, set the ApiKey connection property. To obtain the API key, sign into Microsoft Cognitive Services and register for the Bing Search APIs.

Two API keys are then generated; select either one.

When querying tables, the SearchTerms parameter must be supplied in the WHERE clause.

$conn = Connect-Bing  -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-Bing -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-Bing 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.