Ready to get started?

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

Download Now

Pipe Airtable Data to CSV in PowerShell

Use standard PowerShell cmdlets to access Airtable tables.

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

Creating a Connection to Your Airtable Data

APIKey, BaseId and TableNames parameters are required to connect to Airtable. ViewNames is an optional parameter where views of the tables may be specified.

  • APIKey : API Key of your account. To obtain this value, after logging in go to Account. In API section click Generate API key.
  • BaseId : Id of your base. To obtain this value, it is in the same section as the APIKey. Click on Airtable API, or navigate to https://airtable.com/api and select a base. In the introduction section you can find "The ID of this base is appxxN2ftedc0nEG7."
  • TableNames : A comma separated list of table names for the selected base. These are the same names of tables as found in the UI.
  • ViewNames : A comma separated list of views in the format of (table.view) names. These are the same names of the views as found in the UI.

$conn = Connect-Airtable  -APIKey "$APIKey" -BaseId "$BaseId" -TableNames "$TableNames" -ViewNames "$ViewNames"

Selecting Data

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

Select-Airtable -Connection $conn -Table SampleTable_1 | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\mySampleTable_1Data.csv -NoTypeInformation

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