Build a Raffle with Google Sheet

Jorge Eψ=Ĥψ - Oct 15 '19 - - Dev Community

In this post we'll see how to build a simple application using Google Sheet.

The application consits in a raffle from a list of assistant to an event from we have the names and surnames in a sheet:

Example

Prepare

Select Tools / Script commands from main menú

A new tab appears with the Google Sheet Editor and a Code.gs file. Replace the code with the code shown at the end of the post

Save the proyect as Raffle (or whatever you want) and refresh the Google Sheet tab (F5).

Raffle

A new option appears in the main menu called Raffle with a subitem Raffle.

When the user select this item a sidebar appears with a (customizable) interface with a button to start a raffle:

Sidebar raffle

At this moment the application will choose a random element from the sheet and show it. If the participant is pressent (and want the prize) the user will click at yepes or nopes it the user reject the prize:

winner

In both case the application will mark the participant as "used" to avoid pick him again.

The admin can repeat the raffle as many times he want meanwhile remain participants.

Code

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .