Coding level: Beginner
Duration: 5 minutes
Project type: Automation with a custom menu
Objectives
- Understand what the solution does.
- Understand what the Apps Script services do within the solution.
- Set up the script.
- Run the script.
About this solution
Create a tournament bracket for up to 64 people or teams. This solution creates a tree diagram that represents a single-elimination tournament.
How it works
The script loops through the list of players and determines how many rounds are needed in the bracket. The script formats the Bracket sheet to create the tree diagram and adds the players' names to the first round.
Apps Script services
This solution uses the following service:
Spreadsheet service–Gets the range of players and creates the tree diagram for the tournament.
Prerequisites
To use this sample, you need the following prerequisites:
- A Google Account (Google Workspace accounts might require administrator approval).
- A web browser with access to the internet.
Set up the script
Click the following button to make a copy of the Create a tournament bracket
sample spreadsheet.
Make a copy
Run the script
- In your copied spreadsheet, click Bracket maker > Create bracket. You might need to refresh the page for this custom menu to appear.
When prompted, authorize the script. If the OAuth consent screen displays the warning, This app isn't verified, continue by selecting Advanced > Go to {Project Name} (unsafe).
Click Bracket maker > Create bracket again.
Switch to the Bracket tab to view the tournament bracket.
Review the code
To review the Apps Script code for this solution, click View source code below:
View source code
Code.gs
Contributors
This sample is maintained by Google with the help of Google Developer Experts.