Ready to get started?

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

Download Now

Pipe YouTube Data to CSV in PowerShell

Use standard PowerShell cmdlets to access YouTube tables.

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

Creating a Connection to Your YouTube Data

YouTube uses the OAuth authentication standard. To access Google APIs on behalf on individual users, you can use the embedded CData 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.

$conn = Connect-YouTube 

Selecting Data

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

Select-YouTube -Connection $conn -Table Videos | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myVideosData.csv -NoTypeInformation

You will notice that we piped the results from Select-YouTube 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.