The Table.Schema function in Power Query gives you a table that describes the columns of another table. You get one row per column, with its name, its position, and its data type.
That makes it handy for checking data types at a glance, and for writing queries that work on every number or text column without typing the column names. This article shows both, with eight examples.
Follow along with the example file
Table.Schema Function Examples.xlsx
Table.Schema Function Syntax
Table.Schema(table as table) as table
- table – the table whose columns you want to describe. This is usually a previous step in your query, like
Sourceor#"Changed Type".
What it returns: A table with one row for each column of the input table. The columns you’ll use most are Name, Position (counted from 0), TypeName, Kind, and IsNullable.
TypeName is the full type, like Int64.Type or Currency.Type. Kind is the basic type it belongs to, like number, text, date, or logical (Example 2 shows the difference).
The Table.Schema function is part of the Power Query M language, so it works in Power Query in Excel for Microsoft 365 (Windows and Mac) and in Power BI.
When to Use the Table.Schema Function
Use this function when you need to:
- See the data type of every column in one place
- Find columns that don’t have a data type yet
- Get a list of all the number, text, or date columns in a table
- Apply the same change to every number or text column without typing their names
- Compare two tables before you append them
- Document a table’s columns for someone else
Example 1: See the Schema of a Table
Let’s start with what the function returns. Below is a table named Employees with each employee’s ID, name, hire date, salary, and whether they work remotely, and I want to see the data type of each column.

In Excel, go to Data > Get Data > From Other Sources > Blank Query. In the Power Query Editor that opens, click Home > Advanced Editor, replace the code there with this, and click Done:
let
Source = Excel.CurrentWorkbook(){[Name="Employees"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Employee ID",type text},{"Name",type text},{"Hire Date",type date},{"Salary",Int64.Type},{"Remote",type logical}}),
Schema = Table.Schema(#"Changed Type")
in
Schema
Result: A table with one row for each column of Employees (Employee ID, Name, Hire Date, Salary, and Remote)

Here, the Source line uses the Excel.CurrentWorkbook function to pull the Employees table into Power Query by its name. The Changed Type step then uses the Table.TransformColumnTypes function to give each column a data type, and Table.Schema describes the result.
If you try this on your own data, format it as a table (Ctrl + T) and put your table’s name in place of “Employees”.
In the result, Salary shows Int64.Type as its TypeName (a whole number) and number as its Kind. Hire Date shows Date.Type and date, and Remote shows Logical.Type and logical (TRUE or FALSE).
Position counts from 0, so Employee ID, the first column, is at position 0 and Remote is at position 4. IsNullable is TRUE for every column, which means each column is allowed to hold null (empty) values.
You’ll also see about a dozen more columns, like NumericPrecision, MaxLength, and NativeTypeName. These describe details that some database sources report (like nvarchar as the native type in SQL Server), and for a table from an Excel sheet they’re all null.
Example 2: Create a Simple Column List
Since most of those columns are empty for Excel data, you’ll usually want only the useful ones. Below is a table named Products with prices, stock levels, discounts, and weights, and I want a short list of its columns with their types.

Create a new blank query (as in Example 1), open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="Products"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product",type text},{"Category",type text},{"Unit Price",Currency.Type},{"Stock",Int64.Type},{"Discount",Percentage.Type},{"Weight (kg)",type number}}),
#"Column List" = Table.SelectColumns(Table.Schema(#"Changed Type"),{"Name","Position","TypeName","Kind"})
in
#"Column List"
Result: A four-column table (Name, Position, TypeName, and Kind) with one row for each of the six Products columns

Here, Table.Schema describes the columns, and the Table.SelectColumns function keeps only Name, Position, TypeName, and Kind. That gives you a clean list you can load to a sheet or share with someone.
Look at the last four rows. Unit Price is Currency.Type, Stock is Int64.Type, Discount is Percentage.Type, and Weight (kg) is Number.Type (a decimal number), but all four have number as their Kind.
On the sheet, the discounts are stored as plain decimals (0.1 is 10%). It’s the Changed Type step that tells Power Query to treat that column as a percentage, and Table.Schema reports what the query says, not how the cells look in Excel.
So use TypeName when you need the exact type, and Kind when you just care whether a column holds numbers, text, or dates. That’s what makes Kind so useful in the examples that follow.
Example 3: Find Columns That Don’t Have a Data Type Yet
This next one is a quick health check. Below is a table named Invoices, where the query only set types for Invoice No and Invoice Date, and I want to find the columns that still don’t have a data type.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="Invoices"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Invoice No",type text},{"Invoice Date",type date}}),
#"Untyped Columns" = Table.SelectRows(Table.Schema(#"Changed Type"),each [Kind]="any")[Name]
in
#"Untyped Columns"
Result: A list with Customer, Amount, and Paid

When you pull a table in with Excel.CurrentWorkbook, every column comes in with the type any (shown as ABC123 in the column header). Table.Schema shows these with Any.Type as the TypeName and any as the Kind.
Here, the Table.SelectRows function keeps the schema rows whose Kind is “any”. Adding [Name] at the end pulls out just the Name column, so you get a list of column names instead of a table.
This matters because a column with the type any accepts any value, so nothing stops stray text from getting into Amount. Once Amount is typed as a number, any text entry shows up as an Error in the preview, so you can spot it.
With five columns, you could spot the gaps just by reading the Changed Type step. This check is for a wide table, or a query someone else built, where new columns got added after the Changed Type step was written.
Give each column it returns a proper type in your Changed Type step.
Example 4: Get a List of All Number Columns
Here’s where Table.Schema starts saving you some typing. Below is a table named StoreSales with units sold, revenue, return rate, and the report date for each store, and I want a list of all the columns that hold numbers.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="StoreSales"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Store ID",type text},{"Location",type text},{"Units Sold",Int64.Type},{"Revenue",Currency.Type},{"Return Rate",Percentage.Type},{"Report Date",type date}}),
#"Number Columns" = Table.SelectRows(Table.Schema(#"Changed Type"),each [Kind]="number")[Name]
in
#"Number Columns"
Result: A list with Units Sold, Revenue, and Return Rate

Here, Table.Schema describes the six columns, Table.SelectRows keeps the ones whose Kind is “number”, and [Name] turns them into a list.
Units Sold is a whole number, Revenue is a currency, and Return Rate is a percentage. They have three different TypeNames, but they share the same Kind, so one filter catches all of them.
Power Query also has the Table.ColumnsOfType function for this, but it’s easy to get wrong. After a Changed Type step, Table.ColumnsOfType(#"Changed Type",{type number}) returns no columns at all.
You need {type nullable number} instead, because the Changed Type step makes every column nullable. That version does return all three columns here, but filtering on Kind works whether or not you remember the nullable part.
Example 5: Replace Nulls with 0 in Every Number Column
Now let’s use that list. Below is a table named QuarterlySales with each sales rep’s territory and monthly sales, where some cells are blank, and I want to replace the blanks with 0 in all the month columns.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="QuarterlySales"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Sales Rep",type text},{"Territory",type text},{"Jan",Int64.Type},{"Feb",Int64.Type},{"Mar",Int64.Type}}),
#"Number Columns" = Table.SelectRows(Table.Schema(#"Changed Type"),each [Kind]="number")[Name],
#"Replaced Nulls" = Table.ReplaceValue(#"Changed Type",null,0,Replacer.ReplaceValue,#"Number Columns")
in
#"Replaced Nulls"
Result: The same table with 0 in place of every blank in the Jan, Feb, and Mar columns

Here, the Number Columns step is the same as in Example 4, and it returns the list Jan, Feb, and Mar. The Table.ReplaceValue function then replaces null with 0, but only in the columns on that list.
Gregory’s Territory is also blank, and it stays null. Territory is a text column, so it isn’t on the list, and a 0 there wouldn’t make sense anyway.
The nice part is that you never typed the month names. If an Apr column shows up next quarter and you add it to the Changed Type step, it gets its nulls replaced too, with no change to the replace step.
Example 6: Fix the Capitalization in Every Text Column
This one comes up a lot with data people type by hand. Below is a table named Subscribers with names, cities, and plans typed in all sorts of capitalization, and I want every text column in proper case.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="Subscribers"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name",type text},{"City",type text},{"Plan",type text},{"Seats",Int64.Type}}),
#"Text Columns" = Table.SelectRows(Table.Schema(#"Changed Type"),each [Kind]="text")[Name],
#"Proper Cased" = Table.TransformColumns(#"Changed Type",List.Transform(#"Text Columns",each {_,Text.Proper,type text}))
in
#"Proper Cased"
Result: The same table with Caitlin, Jesse, Nicholas, and Leah in the Name column, and the City and Plan values in proper case too

Here, the Text Columns step returns the list Name, City, and Plan, the columns whose Kind is “text”. Seats is a number column, so it’s left out.
The Table.TransformColumns function needs a list of instructions, one for each column, in the form {column name, function, type}. The List.Transform function builds that list, turning each column name into {"Name",Text.Proper,type text} and so on.
So “san diego” becomes San Diego, “BASIC” becomes Basic, and “JESSE” becomes Jesse. You can swap the Text.Proper function for the Text.Trim or Text.Clean function to tidy up every text column the same way.
Be careful with Text.Proper if any text column holds codes or abbreviations. It would turn a state code like CA into Ca and USA into Usa, so on a table like that, use Text.Trim instead.
Example 7: Compare Two Tables Before Appending Them
Here’s a more advanced use. I have two order tables, JanOrders and FebOrders, and before I append them I want to find any column in February that’s new or has a different data type than in January.
Below is the JanOrders table:

And below is FebOrders, where one order has “N/A” as its amount and there’s an extra Notes column:

In real life, these would usually be two queries someone built a month apart. Because of that “N/A”, the February query sets Amount to text.
Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="FebOrders"]}[Content],
Feb = Table.TransformColumnTypes(Source,{{"Order ID",type text},{"Amount",type text},{"Notes",type text}}),
Jan = Table.TransformColumnTypes(Excel.CurrentWorkbook(){[Name="JanOrders"]}[Content],{{"Order ID",type text},{"Amount",type number}}),
#"Jan Schema" = Table.SelectColumns(Table.Schema(Jan),{"Name","TypeName"}),
#"Feb Schema" = Table.SelectColumns(Table.Schema(Feb),{"Name","TypeName"}),
Differences = Table.RemoveMatchingRows(#"Feb Schema",Table.ToRecords(#"Jan Schema"))
in
Differences
Result: A two-row table with Amount (Text.Type) and Notes (Text.Type)

Here, the Feb and Jan steps load and type the two tables. The next two steps use Table.Schema to get each table’s column names and types.
If you already have the two queries, you can skip the Feb and Jan steps and use your query names inside the two Table.Schema steps instead.
The Table.RemoveMatchingRows function then removes every February row that has an exact match (same name and same type) in January. It needs the rows to remove as a list of records, so the Table.ToRecords function turns each January schema row into one.
Order ID matches, so it goes, and what’s left is everything that’s different.
Amount shows up because it’s text in February but a number in January. If you appended the tables as they are, the combined Amount column would hold a mix of numbers and text, and any sum on it would fail.
Notes shows up because it’s a new column. That’s fine to append, but January’s orders would get null in it, so it’s good to know before you do.
Note that this check only works one way. A column that’s in January but missing from February won’t show up, so in the Differences step, swap #”Feb Schema” and #”Jan Schema” to check the other direction too.
Example 8: Count Columns by Data Type
The last one gives you a quick profile of a table, which helps most on a wide export with dozens of columns.
Below is a smaller table named Projects with text, date, number, and TRUE/FALSE columns, and I want to count how many columns there are of each kind.

Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="Projects"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Project",type text},{"Owner",type text},{"Start Date",type date},{"Due Date",type date},{"Budget",Currency.Type},{"Hours",Int64.Type},{"Complete",type logical}}),
#"Columns by Type" = Table.Group(Table.Schema(#"Changed Type"),{"Kind"},{{"Columns",each Table.RowCount(_),Int64.Type}})
in
#"Columns by Type"
Result: text 2, date 2, number 2, and logical 1

Here, Table.Schema gives one row per column, and the Table.Group function groups those rows by Kind. The Table.RowCount function then counts the rows in each group.
Budget (a currency) and Hours (a whole number) are counted together as number, because the grouping uses Kind. Group by TypeName instead if you want them counted separately.
If the only thing you need is the column names, you don’t need Table.Schema. The Table.ColumnNames function returns them as a list directly, and it’s simpler to read.
Other Excel Articles You May Also Like:
- List.RemoveItems
- List.Average function
- Table.Profile Function in Power Query M
- List.ReplaceValue function
- Excel.Workbook – Use Excel.Workbook in Power Query M to read sheets and tables from a workbook.
- Table.PromoteHeaders – Use Table.PromoteHeaders in Power Query M to make the first row your headers.
- Table.RemoveColumns – Use Table.RemoveColumns in Power Query M to delete columns.
- Table.FromColumns – Use Table.FromColumns in Power Query M to build a table from lists.