Ready to get started?

Download a free trial of the Kintone Cmdlets to get started:

 Download Now

Learn more:

Kintone  Icon Kintone Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Kintone applications and databases. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.

How to pipe Kintone Data to CSV in PowerShell

Use standard PowerShell cmdlets to access Kintone tables.

The CData Cmdlets Module for Kintone is a standard PowerShell module offering straightforward integration with Kintone. Below, you will find examples of using our Kintone Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Kintone Data

In addition to the authentication values, set the following parameters to connect to and retrieve data from Kintone:

  • Url: The URL of your account.
  • GuestSpaceId: Optional. Set this when using a guest space.

Authenticating with Kintone

Kintone supports the following authentication methods.

Using Password Authentication

You must set the following to authenticate:

  • User: The username of your account.
  • Password: The password of your account.

Using Basic Authentication

If the basic authentication security feature is set on the domain, supply the additional login credentials with BasicAuthUser and BasicAuthPassword. Basic authentication requires these credentials in addition to User and Password.

Using Client SSL

Instead of basic authentication, you can specify a client certificate to authenticate. Set SSLClientCert, SSLClientCertType, SSLClientCertSubject, and SSLClientCertPassword. Additionally, set User and Password to your login credentials.

$conn = Connect-Kintone  -User "$User" -Password "$Password" -Url "$Url" -GuestSpaceId "$GuestSpaceId"

Selecting Data

Follow the steps below to retrieve data from the Comments table and pipe the result into to a CSV file:

Select-Kintone -Connection $conn -Table Comments | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myCommentsData.csv -NoTypeInformation

You will notice that we piped the results from Select-Kintone into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.

Deleting Data

The following line deletes any records that match the criteria:

Select-Kintone -Connection $conn -Table Comments -Where "AppId = 1354841" | Remove-Kintone

Inserting and Updating Data

The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into Kintone, checking first whether a record already exists and needs to be updated instead of inserted.

Import-Csv -Path C:\MyCommentsUpdates.csv | %{
  $record = Select-Kintone -Connection $Kintone -Table Comments -Where ("Id = `'"+$_.Id+"`'")
    Update-Kintone -Connection $kintone -Table Comments -Columns ("CreatorName","Text") -Values ($_.CreatorName, $_.Text) -Where ("Id = `'"+$_.Id+"`'")
    Add-Kintone -Connection $kintone -Table Comments -Columns ("CreatorName","Text") -Values ($_.CreatorName, $_.Text)

As always, our goal is to simplify the way you connect to data. With cmdlets users can install a data module, set the connection properties, and start building. Download Cmdlets and start working with your data in PowerShell today!