Model Context Protocol (MCP) finally gives AI models a way to access the business data needed to make them really useful at work. CData MCP Servers have the depth and performance to make sure AI has access to all of the answers.
Try them now for free →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
-
Install the module:
Install-Module TSheetsCmdlets
-
Connect:
$tsheets = Connect-TSheets -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackUrl "$CallbackUrl"
-
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
-
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")
-
Connect to QuickBooks Time:
$conn= New-Object System.Data.CData.TSheets.TSheetsConnection("OAuthClientId=myclientid;OAuthClientSecret=myclientsecret;CallbackUrl=http://localhost:33333;InitiateOAuth=GETANDREFRESH") $conn.Open()
-
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 }