Ready to get started?

Download a free trial of the TSheets Data Provider to get started:

 Download Now

Learn more:

TSheets Icon TSheets ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with TSheets.

Automate TSheets Integration Tasks from PowerShell

Are you in search of a quick and easy way to access TSheets data from PowerShell? This article demonstrates how to utilize the TSheets Cmdlets for tasks like connecting to TSheets data, automating operations, downloading data, and more.

The CData Cmdlets for TSheets are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to TSheets.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to TSheets, but also an SQL interface; this tutorial shows how to use both to retrieve TSheets data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for TSheets. To access TSheets data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for TSheets.

Once you have acquired the necessary connection properties, accessing TSheets data in PowerShell can be enabled in three steps.

TSheets uses the OAuth2 standard for authentication and authorization. To construct your own OAuth app and connect to data, refer to OAuth section in the Help.


  1. Install the module:

    Install-Module TSheetsCmdlets
  2. Connect:

    $tsheets = Connect-TSheets -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackUrl "$CallbackUrl"
  3. Search for and retrieve data:

    $jobcodetype = "regular" $timesheets = Select-TSheets -Connection $tsheets -Table "Timesheets" -Where "JobCodeType = `'$JobCodeType`'" $timesheets

    You can also use the Invoke-TSheets cmdlet to execute SQL commands:

    $timesheets = Invoke-TSheets -Connection $tsheets -Query 'SELECT * FROM Timesheets WHERE JobCodeType = @JobCodeType' -Params @{'@JobCodeType'='regular'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for TSheets\lib\System.Data.CData.TSheets.dll")
  2. Connect to TSheets:

    $conn= New-Object System.Data.CData.TSheets.TSheetsConnection("OAuthClientId=myclientid;OAuthClientSecret=myclientsecret;CallbackUrl=http://localhost:33333;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the TSheetsDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, JobcodeId from Timesheets" $da= New-Object System.Data.CData.TSheets.TSheetsDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.jobcodeid }