Ready to get started?

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

Download Now

Pipe Sage 200 Data to CSV in PowerShell

Use standard PowerShell cmdlets to access Sage 200 tables.

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

Creating a Connection to Your Sage 200 Data

  • Schema: Determines which Sage 200 edition you are connecting to. Specify either StandardUK or ProfessionalUK.
  • Subscription Key: Provides access to the APIs that are used to establish a connection. You will first need to log into the Sage 200 API website and subscribe to the API edition that matches your account. You can do so here: https://developer.columbus.sage.com/docs/services/api/uk. Afterwards, the subscription key may be found in your profile after logging into Sage 200.

$conn = Connect-Sage200  -SubscriptionKey "$SubscriptionKey" -Schema "$Schema"

Selecting Data

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

Select-Sage200 -Connection $conn -Table Banks | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myBanksData.csv -NoTypeInformation

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