Linking Google Forms and Kintone

Introduction

This article introduces how to capture Google Form responses into Kintone using Google Apps Script.

Google Forms allows end users to easily create and send questionnaires and event invitations, but there are many advantages of capturing the form responses into Kintone's databases over spreadsheets.

  1. Access controls
    Kintone allows end users to set granular access controls to the data in its Apps. For example, records that have a "Keep private" answer for one of their Google Form questions can be set so that only the HR department will be able to view the submission data.
  2. Business Process Management
    Workflows can be set for each record in the Kintone App, which makes the post form submission actions clearer. For example, after receiving a Google Forms submission into Kintone, the record can be assigned to a Design team member to work on creating creatives related to the submission data.
  3. Communication
    Each record inside the Kintone App has a feature for posting comments for other team members to read. For example, after receiving a Google Forms submission, an Events team member can write a comment in the record, to reach out to a Sales team member who may have some connection with the submitter of the form.

This tutorial goes through the following steps for development:

  1. Create a Google Form
  2. Create a Kintone App
  3. Create a Google Apps Script program

Step 1. Create a Google Form

Step 1

A Google account will be needed for this step.
Log in to the Google account and select Google Forms from the Google app icon (or directly login from https://docs.google.com/forms/), and click the [+] under Start a new form.

US_01.PNG

Step 2

Enter a title and description for the form.

US_02.png

Step 3

Click the Settings icon, check Collect email address, uncheck all boxes under Requires sign in, and save the changes.

US_03.png

Step 4

Click the Add Question icon and select a question type such as Multiple choice. Enter a question in the question field, as well as the response options.

US_04.png

 

Select Required as below if the question is mandatory.

US_05.png

Step 5

Repeat the process and add more questions.

US_06.png


Google Forms will save every change that is made. Save the form.

2. Create a Kintone App

Step 1

Log in to Kintone, and create a new Kintone App with fields similar to the ones placed in the Google Form.
For reference, this is the Kintone App layout and settings used in the screenshots in this tutorial.

US_07.png

Field Type

Field Name

Field Code

Link

Email

Email

Radio Button

Would you like to participate in this event?

attend

Number

The number of participants

number_of_participants

Text Area

The names of the participants

names_of_participants

Step 2

Click on the Apps settings tab, and click on API Token.

US_08.png

 

Generate a new API Token, check the Add records check-box, and save the settings.

US_09.png

 

Apply the changes made to your App by clicking Update App.

3. Create a Google Apps Script Program

Step 1

Reopen the Google form created in the previous step and click Script editor from the Other menu.

US_10.png

 

Enter a project name and a file name.

US_11.png

Step 2

The following library is used in this tutorial: https://github.com/Arahabica/KintoneManager

Copy the Project Key from the link above. In Google Forms, select Resources and then Libraries.

US_12.png

 

 

Paste the project key into the Add a Library field. Click Add to add the library, select the latest version, and save the settings.

 

US_13.png

Step 3

Copy the following code in to the Google Apps Script.
The strings Email, attend, number_of_participants, and names_of_participants that are listed in the code are the field codes of the fields in the Kintone App. Make sure these names match the field code in the App.
Make sure to also change the subdomain, appid, and token to values that correspond to the Kintone App.

 

Once finished, save the code.

 

Code Explanation

 

Getting data from the Google form

 

The e.response.getItemResponses() function retrieves the submitted form data:

 

The e.reponse.getRespondentEmail() function is used to get the email address of the form submitter, and the request data for Kintone is created:

 

Sending data to Kintone

 

The information of the Kintone App created above is set with the following:

The imported library is initialized, the request data is JSON formatted, and is then sent to Kintone:

The submission to Kintone succeeds if the response code is 200.

Step 4

Select Current project’s triggers from the Edit menu and select a function to run when an event occurs of the Google Form. Click Save when done.

US_14.png

 

US_15.png

 

The set up for Google Apps Script is now complete.

 

4. Test the integration

Click the Send button in the upper right corner of the created Google form, fill out the Send form, and click the Send button.

US_16.png

 

Recipients will receive links to the Google Form.

 

US_17.png

 

Once the form is submitted, the response data should be added to your Kintone App.

 

US_18.png

Finally

Using Google form enables the user to easily create forms for questionnaires, event attendance, etc. and send them to recipients via email or SNS, as well as embedding them in a company website. It also lets the user manage data results efficiently by registering responses to a Kintone App automatically.

Was this article helpful?
2 out of 2 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!