Enable everyone in your organization to access their data in the cloud — no code required.
Learn More →Automate Zoho Creator Integration Tasks from PowerShell
Are you looking for a quick and easy way to access Zoho Creator data from PowerShell? We show how to use the Cmdlets for Zoho Creator and the CData ADO.NET Provider for Zoho Creator to connect to Zoho Creator data and synchronize, automate, download, and more.
The CData Cmdlets for Zoho Creator 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 Zoho Creator.
Cmdlets or ADO.NET?
The cmdlets are not only a PowerShell interface to the Zoho Creator API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Zoho Creator data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Zoho Creator. To access Zoho Creator data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Zoho Creator.
After obtaining the needed connection properties, accessing Zoho Creator data in PowerShell consists of three basic steps.
The connector is already registered with Zoho Creator as an OAuth application.
If you would prefer to use your own custom OAuth app, see the Help documentation.
PowerShell
-
Install the module:
Install-Module ZohoCreatorCmdlets
-
Connect:
$zohocreator = Connect-ZohoCreator -AccountsServer "$AccountsServer"
-
Search for and retrieve data:
$leave_type = "Sick" $leave_types = Select-ZohoCreator -Connection $zohocreator -Table "Leave_Types" -Where "Leave_Type = `'$Leave_Type`'" $leave_types
You can also use the Invoke-ZohoCreator cmdlet to execute SQL commands:
$leave_types = Invoke-ZohoCreator -Connection $zohocreator -Query 'SELECT * FROM Leave_Types WHERE Leave_Type = @Leave_Type' -Params @{'@Leave_Type'='Sick'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Zoho Creator\lib\System.Data.CData.ZohoCreator.dll")
-
Connect to Zoho Creator:
$conn= New-Object System.Data.CData.ZohoCreator.ZohoCreatorConnection("AccountsServer=AccountsServer;InitiateOAuth=GETANDREFRESH") $conn.Open()
-
Instantiate the ZohoCreatorDataAdapter, execute an SQL query, and output the results:
$sql="SELECT ID, Leave_Type from Leave_Types" $da= New-Object System.Data.CData.ZohoCreator.ZohoCreatorDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.leave_type }
Update Zoho Creator Data
PowerShell
Update-ZohoCreator -Connection $ZohoCreator -Columns @('ID','Leave_Type') -Values @('MyID', 'MyLeave_Type') -Table Leave_Types -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("UPDATE Leave_Types SET Leave_Type='Sick' WHERE Id = @myId", $conn)
$cmd.Parameters.Add(new System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myId","10456255-0015501366"))
$cmd.ExecuteNonQuery()
Insert Zoho Creator Data
PowerShell
Add-ZohoCreator -Connection $ZohoCreator -Table Leave_Types -Columns @("ID", "Leave_Type") -Values @("MyID", "MyLeave_Type")
ADO.NET
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("INSERT INTO Leave_Types (Leave_Type) VALUES (@myLeave_Type)", $conn)
$cmd.Parameters.Add(new System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myLeave_Type","Sick"))
$cmd.ExecuteNonQuery()
Delete Zoho Creator Data
PowerShell
Remove-ZohoCreator -Connection $ZohoCreator -Table "Leave_Types" -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("DELETE FROM Leave_Types WHERE Id=@myId", $conn)
$cmd.Parameters.Add(new System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myId","001d000000YBRseAAH"))
$cmd.ExecuteNonQuery()
CodeProject