Create a tournament bracket

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

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.

Screenshot of a tournament bracket

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

Try it

  1. Click the button below to make a copy of the Create a tournament bracket sample spreadsheet.
    Make a copy
  2. Click Bracket maker > Create bracket. You might need to refresh the page for this custom menu to appear.
  3. 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).

  4. Click Bracket maker > Create bracket again.

  5. 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.