Send Quiz in Kaizala from Excel Online

In this post, we will outline the steps to send a quiz into Kaizala. For this post, we will store the questions in Excel Online. You can always send a quiz from any source (be it a SharePoint List or a database) by configuring the API parameters properly.

Read data from Excel Online

For this example, we will create a quiz where each question has 4 options and one correct answer. The question will be the first column of the excel, followed by 4 options and the last column will denote the correct option number. For example if the first option is correct, the last column should store a value 1. The data has to be stored in a table in a .xlsx document.

Fig 1: A table in Excel online depicting the quiz questions, options and correct answer number

Flow Configuration

For reading data from an Excel file and pushing it to Kaizala, we will be using Microsoft Flow with a schedule based trigger. If we want to send out the quiz everyday, we will keep a schedule at a cadence of 1 day as the trigger in Flow. You can import the Flow we will be using in this example from here to follow alongside this post.

Fig 2: Recurrence trigger for Quiz

The first step is to read the individual rows in Excel and create each question with appropriate parameters as expected by Kaizala. For this we read the questions from the Excel in Flow as shown below:

Fig 3: Read the rows from Excel Online

Before we go into the action-body, we have defined few variables which the user can configure like the title of the quiz, the description and whether we want to show correct answer after every question:

Fig 3.1: Initialize variables to be used later

Creating the Quiz Action Body

The action-body of the quiz package expects the following details:

  • title: the title of the quiz
  • questions: an array of questions for the quiz (discussed later)
  • properties: properties of the quiz including correct answers (discussed later)
  • isLocationRequested: whether the quiz expects the participants to share their location
  • validity: how long after the quiz has been published can people respond to it (in hours).
  • isSenderOnly: who can see the details of people who have responded. Setting it to false means that apart from the sender, the admin of the group can also see the responses.

Questions Array

The questions array is an array of question objects apart from 3 default questions that Quiz expects:

  • ResponseTime
  • ResponseLocation
  • CorrectAnswerCount

Since these don’t need to be changed, we have added them to the Questions array after reading the questions in Flow. Apart from these, the actual questions have the following details:

  • id
  • title
  • type: whether it is has single/multiple answer correct.
  • Options: an array of objects, each of which has id and title representing the options for the question.

For every row in the Excel, we parse and compose the question object and add it to the questions array:

Fig 4: For each question, create the question object and append to Questions array

Properties Array

The properties array consist of various properties of the quiz card. Default properties include:

  • DateTime
  • Location
  • Description
  • ShowCorrectAnswer
Fig 5: Populating the properties array with default properties.

Following properties need to be configured while creating the question objects:

  • TrainingProperty: A comma separated string having a list of the questions [e.g. “Q0, Q1”]
  • Qi – tells which property contains the answer of question i
  • Pi – has an array denoting the correct answer to the question it is linked to.
  • TrainingPropertyCount : Number of questions
  • TrainingQuestionCount : Number of questions

The Qi and Pi pair for a question Qi looks like this:

Fig 6: Qi and Pi properties

For each question that we read from Excel, we have to configure Qi and Pi. Hence, inside the same Apply to Each block as shown in Fig 4, we add these properties as shown below:

Fig 6.1: Populating the properties array with question specific properties Qi, Pi and TrainingProperty

Consolidating the Quiz Action Body

Finally, with all sub-parts defined, we create the action body for sending the Quiz:

Fig 7 : Create the quiz action body

Now, we are ready to send the quiz in a group. We can use the quiz package id com.microsoft. kaizala.miniapps.oob.quiz.GA to send the quiz to the group.

Fig 8: Send quiz in a group with the above created action body

Summary

So, we looked at how you can use Microsoft Flow to read questions from a data store and send it to Kaizala. The Flow is shared here for you to import and try out. Please comment below for queries or reach out to kaizaladev@microsoft.com for design related questions.

Appendix

The property and question types do not need to be changed in the Flow. Below are what the numbers depict for questions and properties:

Fig 9: Types explained for Question and Property

2 thoughts on “Send Quiz in Kaizala from Excel Online

Leave a Reply to Dewraj singh Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s