Stay organized with collections
Save and categorize content based on your preferences.
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:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-19 UTC."],[[["This script automates the creation of a single-elimination tournament bracket for up to 64 players or teams in Google Sheets."],["It uses the Spreadsheet service to get player data and generate the bracket diagram on a separate sheet."],["Users need a Google Account and web browser to utilize this tool, and can set it up by making a copy of the provided spreadsheet and running the script from the custom menu."],["The script randomly assigns players to the bracket, ensuring each spot is filled, and accommodates byes for an uneven number of participants."]]],["This script automates the creation of a single-elimination tournament bracket for up to 64 players. Utilizing the Spreadsheet service, it determines the necessary rounds, formats the \"Bracket\" sheet to display a tree diagram, and populates the first round with player names from the \"Players\" sheet. A custom menu, \"Bracket maker\", allows the user to trigger the `createBracket` function, which generates the bracket after obtaining user authorization. The code then uses loops to manage player distribution and bracket formatting.\n"]]