Linking Google Forms and kintone

Introduction

Google Forms allows you to easily create and send questionnaires and event invitations. In this article, we will use Google Apps Script to register Google Form responses to kintone.

The steps for development will be as follows:

  1. Create a Google form
  2. Create a kintone app
  3. Create a Google Apps Script program

1.Create a Google Form

Step 1

A Google account will be needed for this step.
Log in to your Google account, 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 the title and description of your 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, select a question type, such as "Multiple choice". Enter your question in the question field, and 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 you make. Finish off your form, and move on to the next step - create a kintone App.

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 your Google Form.
As reference, this is the kintone App layout and settings used in the screenshots in this article. 

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

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

In this article, we will use the following library: https://github.com/Arahabica/KintoneManager

Copy the Project Key from the link above. On 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 your 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 your App.
Make sure to also change the "subdomain", "appid" and "token" to values that correspond to your kintone App.

 

Once finished, save your 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 Google form you created, 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

5. Finally

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

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