Ready to get started?

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

 Download Now

Learn more:

QuickBooks Time Icon QuickBooks Time ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with QuickBooks Time.

Automate QuickBooks Time Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Provider?

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

Once you have acquired the necessary connection properties, accessing QuickBooks Time 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.

PowerShell

  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'}

ADO.NET

  1. Load the provider's assembly:

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

    $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 $_.id $_.jobcodeid }