Canvas Question from Google Sheet

Have you ever used Canvas for manage a class? If so, what about creating a “formula question?” It can be pretty tough to input the formula, and if you make a mistake, you start all over!!

As an instructor, I solve most of my problems in Excel, lots of linked cells, then I create my exam from the spreadsheet solutions. So, I thought it would be interesting to make my own question maker using Anvil and Google Sheets.

I needed something in the cloud, I have no web page skills, but I’m a Python programmer.

Here is how it works: I wrote an algorithm that tracks a set of cells in Google sheets back to its inputs. This is called precedent/dependency tracking. I put the code in an Anvil server module. Then I call the function from the Anvil front end which communicated with Google Sheets, tracking and creating the equation. It works!! And, it was easy because I wrote the whole thing in Python.

This is how I tested it…first, I took an equation for normal stress in a cantilever beam: (don’t worry about the equations)
image

I put the equations into the Google Sheet as shown:
image

Then I ran the Anvil program which returned the overall formula, based on the Sheet.

Now, looking again at the google sheet, you can see the “red” cell answer matches the “blue” cell answer. You can also see contents of the “red” cell which is the formula that was created.

image

So, it works, Python is a great language for this kind of analysis and Anvil made the front end easy. Now I’ll copy the equation to Canvas and try it. More to come as I progress…

My goal is to link the front end directly to the Canvas API

Cheers!

2 Likes

More updates on verification of the explicit formula, I copied the formula from Anvil to Canvas and created a formula question. Using the same inputs/values, I get exactly the same answer. This verifies, at least in theory, the technique works. Recall from my previous post the answer was 6.25, and the Canvas answer is also 6.25. So 3 different ways to verify the answer: (1) Google sheets with formulas in many cells (2) Google sheets with a single formula created by tracking (3) Canvas. The Canvas interface is shown below: