Pipe X-Cart Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

X-Cart Data Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to X-Cart. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.



Use standard PowerShell cmdlets to access X-Cart tables.

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

Creating a Connection to Your X-Cart Data

An API Key must be created for your XCart Installation. In order to obtain the API Key, you need to install and configure the REST API Module for your X-Cart installation.

  • Login to your X-Cart Installation. Click on My addons on the bottom of the left side-bar navigation panel.
  • Search for REST API Module. Install the Module.
  • After the module has been installed, you need to set it up.
    • Go to the Settings section for the REST API Module.
    • On the settings page specify the API Key (only read)
  • Set the ApiKey and Url to the connection property to connect to data.

$conn = Connect-XCart  -Url "$Url" -ApiKey "$ApiKey"

Selecting Data

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

Select-XCart -Connection $conn -Table PROFILES | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myPROFILESData.csv -NoTypeInformation

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