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 Pipedrive Integration Tasks from PowerShell
Are you in search of a quick and easy way to access Pipedrive data from PowerShell? This article demonstrates how to utilize the Pipedrive Cmdlets for tasks like connecting to Pipedrive data, automating operations, downloading data, and more.
The CData Cmdlets for Pipedrive 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 Pipedrive.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Pipedrive, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Pipedrive data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Pipedrive. To access Pipedrive data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Pipedrive.
Once you have acquired the necessary connection properties, accessing Pipedrive data in PowerShell can be enabled in three steps.
PowerShell
-
Install the module:
Install-Module PipedriveCmdlets
-
Connect:
$pipedrive = Connect-Pipedrive -AuthScheme "$AuthScheme" -CompanyDomain "$CompanyDomain" -APIToken "$APIToken"
-
Search for and retrieve data:
$value = "50000" $deals = Select-Pipedrive -Connection $pipedrive -Table "Deals" -Where "Value = `'$Value`'" $deals
You can also use the Invoke-Pipedrive cmdlet to execute SQL commands:
$deals = Invoke-Pipedrive -Connection $pipedrive -Query 'SELECT * FROM Deals WHERE Value = @Value' -Params @{'@Value'='50000'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Pipedrive\lib\System.Data.CData.Pipedrive.dll")
-
Connect to Pipedrive:
$conn= New-Object System.Data.CData.Pipedrive.PipedriveConnection("AuthScheme=Basic;CompanyDomain=MyCompanyDomain;APIToken=MyAPIToken;") $conn.Open()
-
Instantiate the PipedriveDataAdapter, execute an SQL query, and output the results:
$sql="SELECT PersonName, UserEmail from Deals" $da= New-Object System.Data.CData.Pipedrive.PipedriveDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.personname $_.useremail }
Update Pipedrive Data
PowerShell
Update-Pipedrive -Connection $Pipedrive -Columns @('PersonName','UserEmail') -Values @('MyPersonName', 'MyUserEmail') -Table Deals -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.Pipedrive.PipedriveCommand("UPDATE Deals SET Value='50000' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Pipedrive.PipedriveParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Insert Pipedrive Data
PowerShell
Add-Pipedrive -Connection $Pipedrive -Table Deals -Columns @("PersonName", "UserEmail") -Values @("MyPersonName", "MyUserEmail")
ADO.NET
$cmd = New-Object System.Data.CData.Pipedrive.PipedriveCommand("INSERT INTO Deals (Value) VALUES (@myValue)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Pipedrive.PipedriveParameter("@myValue","50000")))
$cmd.ExecuteNonQuery()
Delete Pipedrive Data
PowerShell
Remove-Pipedrive -Connection $Pipedrive -Table "Deals" -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.Pipedrive.PipedriveCommand("DELETE FROM Deals WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Pipedrive.PipedriveParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject