Visualizing Google Forms survey results using Google Colab

Heemeng Foo
4 min readSep 24, 2020

--

A step-by-step approach

Photo by Campaign Creators on Unsplash

Background

Google Forms is a really useful tool for creating and conducting online surveys. It’s also free and pretty easy to use. However, there are times when you need to perform additional processing to the responses eg. filter out certain responses or aggregate them. After that, you need to visualize the data. For that, Jupyter Notebooks are really useful.

In this article, I cover how to use a Jupyter Notebook, in particular we are going to be using Google’s Colaboratory, which is Google’s implementation of Jupyter Notebook (with many enhancements), to accomplish this.

The files I reference in this article can be found here:

https://gitlab.com/foohm71/mylovelysurvey/

The Google Form

The Google form I am using for this article is called “My Lovely Survey”. It comprises of 4 very common kinds of questions you find in a survey.

The multiple choice question

A multiple choice question

When the results are tallied it looks like this

How results of a multiple choice question is visualized

The checkbox question

How a checkbox question looks like in Google Forms

The results are visualized like this:

How results of a checkbox question are visualized in Google Forms

The linear scale question

How a linear scale question looks like in Google Forms

Results are visualized as such:

How results of a linear scale question are visualized in Google Forms

Open ended questions

How an open ended question looks like in Google Forms

Results are visualized like this:

An example of how open ended question results are visualized in Google Forms (text taken from a news article)

Extracting and visualizing the results

In order to perform additional processing of the results, you will need to obtain the raw format of the results. To do this, click on the 3 vertical dots at the top of the responses part of the form.

Once there, select “Download responses (.csv).

The next few sections can all be found in the Google Colab notebook SurveyResults.ipynb found in the gitlab repository.

The first part is to do the imports. Other than the usual numpy and pandas we have matplotlib, wordcloud and gensim Summarizer.

Next come the functions:

One thing to note is that df is a global variable that is essentially a Pandas Dataframe with the My Lovely Survey.csv read into.

Next, just choose the type of visualization function to use for each question. For example:

plotPieChart(“This is a Multiple Choice question?”)

This will display the following pie chart. If you’re wondering why I’m passing in “This is a Multiple Choice question?” into the function it’s because that is the column name in the df Dataframe.

Notice how similar this is to the presentation in Google Forms.

The others look like this:

Visualizing open ended questions

Open-ended questions are a little more tricky. For this I chose to use the text summarizer and word cloud.

plotWordCloud("An open ended question")
Word Cloud generated using the survey data

Hope this is useful to you.

--

--

Heemeng Foo

Test automation, Engineering management, Data Science / ML / AI Enthusiast