How to Create a Funnel Chart in Google Sheets with ChatGPT

Cody Schneider8 min read

Creating a funnel chart in Google Sheets can feel like a chore, especially since there isn't a direct "funnel chart" option. You can build one manually using a stacked bar chart, but getting the formatting just right takes a lot of tedious clicking. This tutorial will show you a much faster way: using ChatGPT to write a Google Apps Script that builds a perfect funnel chart for you in seconds.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

We'll walk through how to structure your data, how to write the perfect prompt for ChatGPT, and how to run the script to generate your visualization instantly.

What is a Funnel Chart Anyway?

A funnel chart is a visualization that shows how values decrease through sequential stages in a process. Think of a physical funnel - it's wide at the top and narrow at the bottom. This shape is perfect for illustrating concepts like a sales pipeline, marketing conversion process, or user journey on a website.

For example, a common marketing funnel might look like this:

  • Website Visitors: The total number of people who visit your site.
  • Leads: The number of visitors who fill out a form.
  • Marketing Qualified Leads (MQLs): The leads your marketing team identifies as promising.
  • Sales Qualified Leads (SQLs): The MQLs that the sales team accepts to pursue.
  • Customers: The number of leads that make a purchase.

As you move from top to bottom, the number of people at each stage gets smaller. A funnel chart makes it easy to spot the biggest drop-offs in your process so you know where to focus your improvement efforts. Since Google Sheets doesn't offer this chart type out of the box, we have to get a little creative by using a stacked bar chart and some helper data.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 1: Set Up Your Funnel Data

Before you can build the chart, you need to structure your data correctly. Unlike a simple bar chart, a funnel requires a couple of extra "helper" columns to create the centered, pyramid-like shape.

Let's use our marketing funnel example. Start with two columns: Stage and Value.

Stage,Value
Website Visitors,5000
Leads,800
Marketing Qualified Leads,400
Sales Qualified Leads,150
Customers,50

Now, we need to create the helper columns that will center our main data. The trick is to create a stacked bar chart with three series:

  • An invisible bar on the left.
  • Our main, visible data bar in the middle.
  • Another invisible bar on the right.

The two invisible bars will push the center bar into the middle, creating a symmetrical funnel effect. Let's call these columns Invisible Left, Value (which we already have), and Invisible Right. Don't worry, the names don't really matter.

Here's how to structure your sheet:

  1. Enter your funnel stages in column A (e.g., A2:A6).
  2. Enter the corresponding values in column B (e.g., B2:B6).
  3. In column C, we'll calculate the size of the invisible left padding. The formula for cell C2 is:
  4. In column D, simply pull in the original value. The formula for cell D2 is:
  5. In column E, the formula is the same as the "Invisible Left" column to ensure symmetry. The formula for cell E2 is:

Use the fill handle (the little square in the bottom-right corner of the cell) to drag these formulas down for all your stages. Your sheet should now look something like this:

Note: The "Invisible Left" and "Invisible Right" columns will be identical. Their purpose is to add just enough space on either side of each stage's bar so that they all appear centered relative to the largest value (Website Visitors).

Step 2: Tell ChatGPT to Write the Google Apps Script

Now for the fun part. Instead of manually creating a stacked bar chart and fiddling with all the settings, we'll have ChatGPT write the code for us.

Open ChatGPT and give it a detailed prompt. Being specific is the key to getting a script that works right away. A good prompt tells the AI what you want to do, where your data is, and how you want the final chart to look.

The Perfect Prompt

Here is a template you can adapt. Just copy, paste, and adjust the sheet name and data range to match your own:

I need a Google Apps Script to create a funnel chart in Google Sheets.

My data is in a sheet named "Funnel Data" in the range C1:E6.

Column C is the invisible left series, Column D is the actual value, and Column E is the invisible right series. The labels for each stage are in the range A2:A6.

Please create a script that inserts a stacked bar chart into the same sheet. Here are the specific requirements for the chart:

1. Set the chart type to a Stacked Bar Chart.
2. Use the range C1:E6 as the full data range for the chart series.
3. Set the labels for the vertical axis from the range 'Funnel Data'!A2:A6.
4. Title the chart "Marketing Conversion Funnel".
5. Set the first series (from column C) to have no fill color (transparent) to make it invisible.
6. Set the third series (from column E) to also have no fill color to make it invisible.
7. Set the second, middle series (from column D) to the color blue (#4285F4).
8. Add data labels to the middle series (the actual values) and position them in the center of the bar.
9. Remove the chart legend.
10. Do not set a horizontal axis title. The values on the axis should serve as the guide.

The script should create and insert this configured chart onto the "Funnel Data" sheet.
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

The Script from ChatGPT

Within seconds, ChatGPT should provide you with a clean, functional Google Apps Script. It will look something like this:

function createFunnelChart() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Funnel Data"),
  if (sheet) {
    const dataRange = sheet.getRange("C1:E6"),
    const labelRange = sheet.getRange("A2:A6"),
    const chartBuilder = sheet.newChart(),

    chartBuilder
      .setChartType(Charts.ChartType.BAR)
      .setOption('isStacked', true)
      .addRange(dataRange)
      .setOption('series', {
        0: { color: 'transparent' }, // Invisible Left Series
        1: { color: '#4285F4', dataLabel: 'value' }, // Main Value Series
        2: { color: 'transparent' } // Invisible Right Series
      })
      .setOption('title', 'Marketing Conversion Funnel')
      .setOption('legend', { position: 'none' })
      .setOption('hAxis', { title: null, showTextEvery: 1, minValue: 0 })
      .setOption('vAxis', {
        title: null,
        textPosition: 'none',
        titleTextStyle: { fontSize: 14 }
      })
      .setOption('annotations', {
        stem: { length: 4 },
        textStyle: { fontSize: 12, color: 'black', bold: true }
      }),

    // Set labels for vertical axis
    sheet.getRange("A2:A6").setValues(labelRange.getValues()),

    // Build and insert chart
    sheet.insertChart(chartBuilder.build()),
  } else {
    SpreadsheetApp.getUi().alert('"Funnel Data" sheet not found.'),
  }
}

Even if you don't read code, you can see how the instructions from our prompt are reflected in the script's options, like the title, colors, and legend position.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 3: Run the Script in Google Sheets

With the script in hand, it's time to bring your chart to life. Back in your Google Sheet, open the script editor:

  1. Go to Extensions > Apps Script. A new tab will open with the script editor.
  2. Delete any placeholder code that's in the editor (the empty myFunction block).
  3. Paste the entire script provided by ChatGPT.
  4. Click the Save project icon (it looks like a floppy disk).
  5. Click the Run button.

The first time you run the script, Google will ask for authorization. This is normal because you're allowing the script to make changes to your spreadsheet. Follow the prompts to approve it:

  • Click Review permissions.
  • Choose your Google account.
  • You may see a "This app isn't verified" screen. Click Advanced, then click "Go to (your script name) (unsafe)". It's perfectly safe - you wrote the "app"!
  • Click Allow.

Once authorized, click Run again. Switch back to your Google Sheet, and voila! You should see a perfectly formatted funnel chart ready to go.

Step 4: Making Final Tweaks

The script gets you 95% of the way there instantly, but you can always make final adjustments manually.

Just double-click on the chart to open the Chart editor sidebar in Google Sheets. From there, you can:

  • Change colors: Don't like blue? Go to the Series section and pick a different color for your main data series.
  • Adjust fonts: Modify the font size, color, or style of your data labels, title, or axis labels.
  • Add context: Edit your data to include conversion rate percentages for each stage (e.g., "(80%)", "(50%)") next to the stage names for a richer visualization.

The script handles the heavy lifting of creation and complex formatting, leaving you with the simple, creative tweaks.

Final Thoughts

While Google Sheets lacks a one-click funnel chart option, combining a stacked bar chart with a Google Apps Script makes the process fast and replicable. Using a tool like ChatGPT to generate that script for you skips the learning curve of both coding and the finer points of chart configuration, turning a tedious task into a quick conversation.

If you find yourself building marketing and sales reports often, manually updating this kind of setup in Google Sheets can start to feel repetitive. We created Graphed because we believe getting insights shouldn't involve fighting with formulas or scripts. Instead of setting up helper columns, you can connect your data sources like Google Analytics, salespeople, and Shopify in a few clicks, then just ask, "Show me a marketing funnel for the last quarter." We instantly build a live, interactive dashboard that always stays up-to-date, freeing you from manual reporting for good.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!