Coding level: Beginner
Duration: 5 minutes
Project type: Automation with a custom menu
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.
Before you begin
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
- Click the button below to make a copy of the Create a tournament bracket
Make a copy
- Click Bracket maker > Create bracket. You might need to refresh the page for this custom menu to appear.
- When prompted, authorize the script.
- Click Bracket maker > Create bracket again.
- Switch to the Bracket tab to view the tournament bracket.
Open the Apps Script project
The sample script's code includes in-line comments to help you understand how it works. To access the code, in the spreadsheet, click Extensions > Apps Script.
This sample is maintained by Google with the help of Google Developer Experts.