HomeGoogle DocsSpreadsheetGoogle Sheets QUERY LABEL Clause: Rename & Remove Column Headers

Google Sheets QUERY LABEL Clause: Rename & Remove Column Headers

The LABEL clause in the Google Sheets QUERY function lets you rename or remove column headers in the query output. It’s especially useful when Google Sheets generates less meaningful headers such as sum Sales, year(Date), or product(sum Units10()), or when you want different column names without editing the source data.

In this guide, you’ll learn how to rename regular columns, aggregation results, scalar functions, arithmetic expressions, and even remove headers entirely using the LABEL clause.

In the QUERY syntax, the LABEL clause appears second to last, immediately before the FORMAT clause, which is the final clause.

The LABEL clause can:

  • rename regular columns,
  • rename calculated columns,
  • remove column headers, and
  • assign headers to data without a header row.

Quick Reference Cheat Sheet

GoalFormula Example
Rename a columnSELECT A, G LABEL G 'Revenue'
Rename multiple columnsSELECT B, C, G LABEL B 'Sales Rep', C 'Sales Region', G 'Revenue'
Remove a headerSELECT G LABEL G ''
Rename an aggregationSELECT C, SUM(G) GROUP BY C LABEL SUM(G) 'Total Sales'
Rename a scalar functionSELECT YEAR(A), SUM(G) GROUP BY YEAR(A) LABEL YEAR(A) 'Year', SUM(G) 'Revenue'
Rename an arithmetic expressionSELECT B, SUM(E)*10 GROUP BY B LABEL SUM(E)*10 'Bonus Points'

Syntax: Labeling Columns

The basic syntax of the LABEL clause is:

LABEL column_id 'label_string' 
  • column_id: The column identifier to label. Use column letters (A, B, etc.) when querying a physical range, and Col1, Col2, etc., when querying an array expression such as {A1:B} or IMPORTRANGE(...). The column_id can also be an expression, such as an aggregation function (SUM(D), MAX(Col4)), a scalar function (YEAR(A)), or an arithmetic expression (A+B, SUM(B)-SUM(C)).
  • label_string: The custom column header enclosed in single quotes, for example, 'Total Sales'. Use an empty string ('') to remove the column header altogether.

When renaming multiple columns in a single QUERY formula, use the LABEL keyword only once and separate each column identifier and label pair with commas. Any columns or expressions not included in the LABEL clause will retain their default header names.

Tip: Label text can be enclosed in either single quotes ('Revenue') or doubled double quotes (""Revenue""). Doubled double quotes are useful when the label contains an apostrophe, for example: LABEL G ""Student's Grade""

Sample Data

Google Sheets QUERY LABEL clause example showing sample data and automatically generated column headers
Sample data and the default column headers generated by the QUERY function before applying the LABEL clause.

Click the button below to make a copy of the sample sheet and follow along with the examples.

Copy Sample Sheet

Example 1: Rename Regular Columns

You can also use the LABEL clause to rename regular columns. Although you can usually edit the source headers, there are situations where that’s not practical. For example:

  • The data comes from a Google Form response sheet.
  • The data is imported using IMPORTRANGE, and you don’t have permission to edit the source sheet.
  • You want different header names for different query results.

In these situations, the LABEL clause lets you assign custom column headers without modifying the source data.

Formula:

=QUERY(A1:G, "SELECT A, G LABEL A 'Order Date', G 'Revenue'", 1)

This formula returns the Date and Sales columns, but renames their headers to Order Date and Revenue, respectively, without modifying the source data.

QUERY LABEL clause example renaming regular column headers in Google Sheets

Important: When the query source is an expression such as IMPORTRANGE(...), use Col1, Col2, etc., instead of column letters. This applies to all examples in this tutorial.

If the data source is IMPORTRANGE(...), use:

=QUERY(IMPORTRANGE("spreadsheet_url","Sheet1!A:G"), "SELECT Col1, Col7 LABEL Col1 'Order Date', Col7 'Revenue'", 1)

Example 2: Rename Aggregation Headers

When you use aggregation functions such as SUM, COUNT, AVG, MIN, or MAX, Google Sheets automatically generates headers such as sum Sales or count Sales. You can use the LABEL clause to replace these default headers with more meaningful names.

Formula:

=QUERY(A1:G, "SELECT C, SUM(G) WHERE C IS NOT NULL GROUP BY C LABEL SUM(G) 'Total Sales'", 1)

This formula groups the data by Region (column C) and returns the total sales for each region.

The LABEL clause renames the aggregation header from sum Sales to Total Sales.

Google Sheets QUERY LABEL clause renaming an aggregation header from sum Sales to Total Sales

Example 3: Rename Scalar Function Headers

Scalar functions behave the same way. Common scalar functions in the QUERY function include YEAR, MONTH, DAY, HOUR, and DATE.

You can use the LABEL clause to replace these automatically generated headers with more descriptive names.

Formula:

=QUERY(A1:G, "SELECT YEAR(A), MONTH(A), SUM(G) WHERE A IS NOT NULL GROUP BY YEAR(A), MONTH(A) LABEL YEAR(A) 'Year', MONTH(A) 'Month', SUM(G) 'Revenue'", 1)

This formula groups the data by Year and Month and returns the total revenue for each month. The LABEL clause renames the generated headers to Year, Month, and Revenue.

Google Sheets QUERY LABEL clause renaming the YEAR, MONTH, and SUM column headers to Year, Month, and Revenue

Example 4: Rename Headers for Arithmetic Expressions

Arithmetic expressions can generate some of the longest and most cumbersome headers in a QUERY result.

For example, an expression such as SUM(E)*10 may generate a header like product(sum Units10()) (or a similar automatically generated label).

You can use the LABEL clause to replace these with meaningful column names.

Formula:

=QUERY(A1:G, "SELECT B, SUM(E)*10 WHERE B IS NOT NULL GROUP BY B LABEL SUM(E)*10 'Bonus Points'", 1)

This formula groups the data by Salesperson (column B) and calculates Bonus Points by multiplying the total units sold by 10.

Google Sheets QUERY LABEL clause renaming an arithmetic expression header to Bonus Points

Without the LABEL clause, the second column would display an automatically generated header such as product(sum Units10()) . The LABEL clause replaces this with the much clearer header Bonus Points.

Working with Data That Has No Header Row

All of the examples above assume that the source data contains a header row. However, in some situations the source data may not have headers—for example, when you extract a portion of a dataset or generate data using a formula.

In such cases, specify the headers argument (the third argument of QUERY) as 0 instead of 1. Since there are no source headers to inherit, the output column headers will be blank unless you define them using the LABEL clause.

For example:

=QUERY(A2:G, "SELECT A, G LABEL A 'Date', G 'Revenue'", 0)

This formula treats the data as having no header row and assigns Date and Revenue as the output column headers.

Frequently Asked Questions

Can I rename Pivot column headers?

No. The LABEL clause cannot rename pivot column headers. Pivot headers are generated from the unique values in the pivot column, so they are treated as categories, not column names.

Do I need to follow a specific clause order when using the LABEL clause?

Yes. The LABEL clause must appear near the end of the query. It comes after clauses such as SELECT, WHERE, GROUP BY, PIVOT, ORDER BY, LIMIT, and OFFSET.

If you also use the FORMAT clause, LABEL must appear immediately before it, because FORMAT is always the final clause in a QUERY statement.

Related: What is the Correct Clause Order in Google Sheets Query?

Can I remove only one column header?

Yes. Specify an empty label.

LABEL G ''

Other column headers remain unchanged.

Conclusion

The LABEL clause makes QUERY results easier to read by replacing Google’s automatically generated headers with meaningful names. Whether you’re renaming regular columns, aggregation results, scalar functions, or arithmetic expressions—or simply removing a header—it helps you create cleaner and more informative query output.

Remember to use the same column identifiers or expressions as in the SELECT clause, and place the LABEL clause immediately before the optional FORMAT clause.

Prashanth K V
Prashanth K V
Your Trusted Google Sheets and Excel Expert Prashanth K V is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Most Discussed

More like this

Google Sheets Document Expiry Tracker Template (Free Download)

Missing your visa renewal, vehicle insurance renewal, emission certificate expiry, domain renewal, or scheduled...

Google Sheets Habit Tracker Template (Free & Automated)

Want to monitor your habits and track your progress over a month or across...

How to Sort a Pivot Table by Value in Google Sheets

Google Sheets lets you sort Pivot Tables by row fields, column fields, or summarized...

11 COMMENTS

  1. Good morning,

    Thanks for these great examples.

    I can’t replace the months in figures in my formula with their names.

    Thanks for the help.

  2. Hi, If I have a Query that populates a column with a string, for example, "select 'Canada', B, Sum(C)" and I want to set a label for the column 'Canada', what syntax can I use?

    Thank you!

    • Hi, Caroline,

      This example might help you.

      =query(A1:C,"select 'Canada', B, Sum(C) group by 'Canada',B label 'Canada''New Column'")

      Replace New Column with the label you want.

  3. You, sir/madam, are awesome! I’ve been trying to figure out how to label column headers after the pivot.
    This is exactly what I was looking for. Thank you!

  4. This was exactly what I was looking for, I couldn’t find a way to label aggregated columns with formulas. Thanks!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.