So far so good. You’re probably thinking: I could get this done in Google Sheets since Google Sheets allows real-time editing by multiple team members. Read on.

Automating With Formulas and Buttons

In the main questions table, we also have a column for the person who raised the question. If you are in a Google Sheet, you would have to manually write in your name in the cell to indicate you asked the question. By using this formula for this column in our table, the column will pre-populate with the user who is adding a row to the table:

=thisRow.CreatedBy()

The Who Asked the Question? column is a People column type that shows an avatar of the person on your team. Now let’s also add two more column to capture the people who have upvoted or downvoted a question:

Upvotes and Downvotes are also the People column type since these columns will contain the people on the team that upvoted/downvoted. You also want to make sure the “Allow Multiple Selections” toggle is turned on so that multiple people can show up in the Upvotes or Downvotes columns:

Now for the fun part, adding the buttons! Buttons make your table feel more interactive and is a core building block that turns your doc into an app. First start by adding the columns with the Button column format:

Before we write the button formulas, let’s just make our buttons look more user-friendly. I like to use the thumbs up 👍 emoji for the upvote button and the thumbs down 👎 emoji for the downvote button. I use a green and red background for the buttons, respectively:

Now we need to configure the buttons with the right formulas so they actually account for who upvotes and downvotes a question. This is probably the most “complicated” formula you’ll have to write to get your doc up and running!

In the Vote Up column that contains our upvote button, you are going to modify the current row when the button is pressed. You modify the Upvotes column by writing the following formula:

=Splice(thisRow.Upvotes,0,0,User())

The Splice formula is typically used when you want to insert some values into a list but also replaces items in that list. In this formula:

thisRow.Upvotes is our list of values

is our list of values The first “0” is where we want to start inserting new values

The second “0” is how many values in our list we want to replace

User() is what we want to insert into the list

When it’s all said and done, all this formula does is add the current user (your teammate that is hitting the upvote button) to the Upvotes column so that this column will have a cumulative list of all the people who hit the upvote button! There is no deleting of values with this formula. In the gif below, you’ll see that I get added to the Upvotes column when I hit the upvote button:

A few other things to make this voting doc user-friendly:

Disabling the button when someone has voted or downvoted

The formula basically looks to see if the current user is in the Upvotes or Downvotes columns. If they are, then disable the button:

=thisRow.Upvotes.Contains(User()) OR thisRow.Downvotes.Contains(User())

Badges on the buttons

In the button right-hand corner of the button, you can show the count on the number of people who have upvoted or downvoted for the question. Put the following formula in the “Badge” form on the button”

=thisRow.Upvotes.Count()

Clear button

In our voting doc, we only let the person upvote or downvote a question once. If that person wants to “clear” their vote and switch their vote, having a clear button makes it easy to remove their current vote.

The formula on this button is a little more complicated. You are also modifying the current row, and the formula looks for the current user in the Upvotes column. If it finds the current user, it filters the user out by using the condition CurrentValue!=User() .

You can also disable the Clear button by using the Not formula:

We only want to disable the Clear button when the current voter is not found in the Upvotes or Downvotes columns. No point in removing your vote if you haven’t event voted in the first place!

Seeing the voting action

Assuming you followed the steps above for getting the Vote Up button to work, do the same thing for the Vote Down button but switch the places where the Upvotes column was mentioned for the Downvotes column. Here our little voting doc in action:

Sorting Questions

One of the most important parts about this voting doc is to make sure the questions that get the most upvotes go to the top of the list. Add two columns to your table: Votes Up and Votes Down that simply count the number people in the Upvotes and Downvotes columns, respectively: