Automate QuickBooks Online Integration Tasks from PowerShell

Ready to get started?

Download a free trial:

Download Now

Learn more:

QuickBooks Online ADO.NET Provider

Complete read-write access to QuickBooks Online enables developers to search (Customers, Transactions, Invoices, Sales Receipts, etc.), update items, edit customers, and more, from any .NET application.

Are you looking for a quick and easy way to access QuickBooks Online data from PowerShell? We show how to use the Cmdlets for QuickBooks Online and the CData ADO.NET Provider for QuickBooks Online to connect to QuickBooks Online data and synchronize, automate, download, and more.

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing QuickBooks Online data in PowerShell consists of three basic steps.

QuickBooks Online uses the OAuth authentication standard. OAuth requires the authenticating user to log in through the browser. To authenticate using OAuth, you can use the embedded OAuthClientId, OAuthClientSecret, and CallbackURL or you can obtain your own by registering an app with Intuit. Additionally, if you want to connect to sandbox data, set UseSandbox to true.

See the Getting Started chapter of the help documentation for a guide to using OAuth.


  1. Install the module:

    Install-Module QuickBooksOnlineCmdlets
  2. Connect:

    $quickbooksonline = Connect-QBOnline
  3. Search for and retrieve data:

    $fullyqualifiedname = "Cook, Brian" $customers = Select-QBOnline -Connection $quickbooksonline -Table "Customers" -Where "FullyQualifiedName = `'$FullyQualifiedName`'" $customers

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

    $customers = Invoke-QBOnline -Connection $quickbooksonline -Query 'SELECT * FROM Customers WHERE FullyQualifiedName = @FullyQualifiedName' -Params @{'@FullyQualifiedName'='Cook, Brian'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.QuickBooksOnline.QuickBooksOnlineConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the QuickBooksOnlineDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT DisplayName, Balance from Customers" $da= New-Object System.Data.CData.QuickBooksOnline.QuickBooksOnlineDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.displayname $_.balance }

Update QuickBooks Online Data


Update-QBOnline -Connection $QuickBooksOnline -Columns @('DisplayName','Balance') -Values @('MyDisplayName', 'MyBalance') -Table Customers -Id "MyId"


$cmd = New-Object System.Data.CData.QuickBooksOnline.QuickBooksOnlineCommand("UPDATE Customers SET FullyQualifiedName='Cook, Brian' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.QuickBooksOnline.QuickBooksOnlineParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert QuickBooks Online Data


Add-QBOnline -Connection $QuickBooksOnline -Table Customers -Columns @("DisplayName", "Balance") -Values @("MyDisplayName", "MyBalance")


$cmd = New-Object System.Data.CData.QuickBooksOnline.QuickBooksOnlineCommand("INSERT INTO Customers (FullyQualifiedName) VALUES (@myFullyQualifiedName)", $conn) $cmd.Parameters.Add(new System.Data.CData.QuickBooksOnline.QuickBooksOnlineParameter("@myFullyQualifiedName","Cook, Brian")) $cmd.ExecuteNonQuery()

Delete QuickBooks Online Data


Remove-QBOnline -Connection $QuickBooksOnline -Table "Customers" -Id "MyId"


$cmd = New-Object System.Data.CData.QuickBooksOnline.QuickBooksOnlineCommand("DELETE FROM Customers WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.QuickBooksOnline.QuickBooksOnlineParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()