Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Record.ToTable: Step-by-Step Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Record.ToTable converts a single record into a two-column table with the field names in one column and their values in the other. It is the standard way to turn a record — whether from a JSON object, a grouped aggregation, or a parameter — into rows you can filter, merge, or load. You need Power Query Editor in Excel or Power BI; no add-ins or special permissions are required.

What You'll Need

  • Excel (Microsoft 365 or 2021+) or Power BI Desktop with Power Query Editor available.
  • A record to convert. This can come from a JSON file, a web API response, a grouped query step, or a manually entered record.
  • Basic familiarity with the Power Query Editor interface: the Queries pane, the formula bar, and the Applied Steps list.

Step-by-Step

  1. Open Power Query Editor. In Excel, go to Data > Get Data > Launch Power Query Editor. In Power BI Desktop, click Transform Data on the Home ribbon. Menu labels can differ slightly by version and platform.
  2. Load or create the record you want to convert. For a JSON file, use Data > Get Data > From File > From JSON. For a web API, use Data > Get Data > From Web. If you already have a query that returns a record, select it in the Queries pane.
  3. Confirm the query output is a record, not a table. The preview area will show a single row with a Record link in the cell, and the status bar at the bottom will say Record. If it says Table, you already have a table and do not need this function.
  4. Add a custom step. Right-click the query in the Queries pane and choose Advanced Editor, or click the fx button next to the formula bar to insert a step. In the formula bar, replace the existing formula with = Record.ToTable(Source), where Source is the name of the previous step shown in the Applied Steps list.
  5. Press Enter or click the checkmark to commit the step. The preview updates to a two-column table. The first column is named Name and holds the field names; the second is named Value and holds the corresponding values.
  6. Rename the columns if needed. Double-click the Name or Value column header and type a clearer label, such as Setting and CurrentValue. This matters when you later merge or pivot the result.
  7. Expand or transform the Value column as required. If values are themselves records or tables, click the expand icon in the column header and choose the fields you want. If values are mixed types, use Transform > Data Type > Any to avoid conversion errors.
  8. Close and load. Go to Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to send the table to a worksheet or the data model.

Common Mistakes

  • Passing a table instead of a record. Record.ToTable expects a record. If you pass a table, you get an error. Use Table.ToRecords first if you need to convert a one-row table to a record.
  • Referencing the wrong step name. The argument must be the exact name of the previous step, including capitalization and spaces. A typo produces "The name 'X' wasn't recognized."
  • Forgetting that nested records stay nested. Record.ToTable does not flatten nested records. You must expand the Value column afterward.
  • Assuming column order is stable. The Name column follows the field order in the record, which can vary between JSON responses. Sort the Name column if order matters.
  • Using it on a list. A list is not a record. Use List.ToTable or List.Transform instead.

Tips

  • Combine with Record.FieldNames and Record.FieldValues when you need to inspect a record before converting it.
  • Use Table.Transpose after Record.ToTable to turn a single record into a one-row table with fields as columns — useful for appending many records into a wide table.
  • When converting many records, wrap the call in Table.TransformColumns or List.Transform to apply Record.ToTable to each record in a list, then combine with Table.Combine.
  • Set the Value column data type explicitly after conversion. Leaving it as Any can cause slow refreshes and unexpected errors downstream.
  • Name steps descriptively in the Applied Steps list so the argument you pass to Record.ToTable is easy to read later.

Troubleshooting

If you see "We cannot convert a value of type Table to type Record," the previous step returns a table. Add a step using Table.First or Table.ToRecords to isolate a single record before calling Record.ToTable. If the preview shows an error in every row, the Value column likely contains mixed types; set the column type to Any, then convert individual rows. If the function returns only one row, the record genuinely has one field — check the source JSON or the grouping step that produced it. If the query is slow, the record may be very large or nested deeply; expand nested records step by step rather than all at once. If the Name column shows numbers instead of text, the source is a list, not a record — use List.ToTable instead.

Frequently Asked Questions

What is the difference between Record.ToTable and Table.FromRecords?

Record.ToTable converts one record into a two-column name/value table. Table.FromRecords converts a list of records into a table where each record becomes a row and field names become columns.

Can I use Record.ToTable on a record returned by Group By?

Yes. The All Rows operation in Group By produces a table column, but the grouped value itself is a record. Reference the specific step and pass it to Record.ToTable.

Does Record.ToTable preserve field order?

It follows the order fields appear in the record. JSON and API responses may not guarantee order, so sort the Name column if you need a fixed sequence.

Why does my Value column show "Record" instead of actual values?

The record contains nested records. Click the expand icon in the Value column header and select the fields you want to surface.

Can I rename the output columns?

Yes. Rename them with Table.RenameColumns or by double-clicking the headers in the preview. The default names are Name and Value.

Is Record.ToTable available in all Power Query versions?

It is a standard M function available in Excel Power Query and Power BI Desktop. Very old versions may lack it; update your application if the function is not recognized.