Pipe PayPal Data to CSV in PowerShell

Ready to get started?

Download a free trial of the PayPal Cmdlets to get started:

 Download Now

Learn more:

PayPal Icon PayPal Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to PayPal data. The Cmdlets allow users to easily query live data - just like working with SQL server.

Use standard PowerShell cmdlets to access PayPal tables.

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

Creating a Connection to Your PayPal Data

The provider surfaces tables from two PayPal APIs. The APIs use different authentication methods.

  • The REST API uses the OAuth standard. To authenticate to the REST API, you will need to set the OAuthClientId, OAuthClientSecret, and CallbackURL properties.
  • The Classic API requires Signature API credentials. To authenticate to the Classic API, you will need to obtain an API username, password, and signature.

See the "Getting Started" chapter of the help documentation for a guide to obtaining the necessary API credentials.

To select the API you want to work with, you can set the Schema property to REST or SOAP. By default the SOAP schema will be used.

For testing purposes you can set UseSandbox to true and use sandbox credentials.

$conn = Connect-PayPal  -Schema "$Schema" -Username "$Username" -Password "$Password" -Signature "$Signature"

Selecting Data

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

Select-PayPal -Connection $conn -Table Transactions | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myTransactionsData.csv -NoTypeInformation

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