Visualizing Google Forms survey results using Google Colab
A step-by-step approach
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:
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
When the results are tallied it looks like this
The checkbox question
The results are visualized like this:
The linear scale question
Results are visualized as such:
Open ended questions
Results are visualized like this:
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")
Hope this is useful to you.