Automate SurveyMonkey Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

SurveyMonkey ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with SurveyMonkey data including Rollups, Surveys, Questions, and more!

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

The CData Cmdlets for SurveyMonkey 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 SurveyMonkey.

Cmdlets or ADO.NET?

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

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

SurveyMonkey uses the OAuth 2 authentication standard. See the Getting Started section in the help documentation for a guide.


  1. Install the module:

    Install-Module SurveyMonkeyCmdlets
  2. Connect:

    $surveymonkey = Connect-SurveyMonkey -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL"
  3. Search for and retrieve data:

    $choicetext = "blue" $mysurvey_responses = Select-SurveyMonkey -Connection $surveymonkey -Table "MySurvey_Responses" -Where "ChoiceText = `'$ChoiceText`'" $mysurvey_responses

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

    $mysurvey_responses = Invoke-SurveyMonkey -Connection $surveymonkey -Query 'SELECT * FROM MySurvey_Responses WHERE ChoiceText = @ChoiceText' -Params @{'@ChoiceText'='blue'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.SurveyMonkey.SurveyMonkeyConnection("OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:portNumber;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the SurveyMonkeyDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT RespondentId, ChoiceId from MySurvey_Responses" $da= New-Object System.Data.CData.SurveyMonkey.SurveyMonkeyDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.respondentid $_.choiceid }

Update SurveyMonkey Data


Update-SurveyMonkey -Connection $SurveyMonkey -Columns @('RespondentId','ChoiceId') -Values @('MyRespondentId', 'MyChoiceId') -Table MySurvey_Responses -Id "MyId"


$cmd = New-Object System.Data.CData.SurveyMonkey.SurveyMonkeyCommand("UPDATE MySurvey_Responses SET ChoiceText='blue' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.SurveyMonkey.SurveyMonkeyParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert SurveyMonkey Data


Add-SurveyMonkey -Connection $SurveyMonkey -Table MySurvey_Responses -Columns @("RespondentId", "ChoiceId") -Values @("MyRespondentId", "MyChoiceId")


$cmd = New-Object System.Data.CData.SurveyMonkey.SurveyMonkeyCommand("INSERT INTO MySurvey_Responses (ChoiceText) VALUES (@myChoiceText)", $conn) $cmd.Parameters.Add(new System.Data.CData.SurveyMonkey.SurveyMonkeyParameter("@myChoiceText","blue")) $cmd.ExecuteNonQuery()

Delete SurveyMonkey Data


Remove-SurveyMonkey -Connection $SurveyMonkey -Table "MySurvey_Responses" -Id "MyId"


$cmd = New-Object System.Data.CData.SurveyMonkey.SurveyMonkeyCommand("DELETE FROM MySurvey_Responses WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.SurveyMonkey.SurveyMonkeyParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()