Smart Systems for Home

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

Power Query Record.ToList Function: How to Use It

· 4 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.ToList is a Power Query M function that converts every field value of a record into a flat list, in the order the fields appear. You call it as Record.ToList(record) and it returns a list containing each field's value with the field names stripped away. It is handy when you want to combine a record's values, count them, or feed them into list functions without caring which field they came from. You need Power Query, which is built into Excel (Windows and Mac) and Power BI Desktop, so there is nothing extra to install.

What You'll Need

  • Excel for Windows or Mac with Power Query, or Power BI Desktop (free from Microsoft)
  • A query that produces at least one record, or a nested record column
  • Basic familiarity with the Advanced Editor (Home > Advanced Editor in the Power Query Editor)

Step-by-Step

  1. Open your query in the Power Query Editor. In Excel, go to Data > Get & Transform Data and load your source, or in Power BI use Home > Transform Data. Menu labels can differ slightly between versions, but the Power Query Editor itself is the same.
  2. Confirm you actually have a record. Click a cell in the preview. If a value shows as "Record", Record.ToList can work on it. If it shows as "Table" or "List", you need a different function (Table.ToRecords or List.Accumulate style approaches).
  3. Add a custom step. Open the Advanced Editor (Home > Advanced Editor) or add a custom column (Add Column > Custom Column) if you are working with a record column in a table.
  4. Call the function. For a single record held in a step called Source, type: Record.ToList(Source) For a record inside a table column, add a custom column with: Record.ToList([MyRecordColumn])
  5. Check the output. The result is a list of the record's values, ordered exactly as the fields were defined. For example, a record becomes the list {"Ana", 34, "Leeds"} .
  6. Use the list downstream. Common follow-ups: List.Count(Record.ToList([Rec])) to count fields, Text.Combine(List.Transform(Record.ToList([Rec]), Text.From), ", ") to flatten values into one text string, Record.ToList([Rec]){0} to grab the first value.
  7. Load the results. Click Close & Load (Excel) or Close & Apply (Power BI) to write the output back to your workbook or model.

Common Mistakes

  • Passing a table or list instead of a record. Record.ToList only accepts records. Passing anything else raises an Expression.Error. Check the type shown in the preview cell first.
  • Forgetting the square brackets. To reference a record stored in a column named Rec, it must be [Rec], not Rec. Omitting the brackets references a step name instead and usually fails.
  • Expecting field names in the output. The output contains values only. If you need names too, use Record.FieldNames alongside it, or Record.ToTable for a proper name/value table.
  • Assuming alphabetical ordering. Values keep the record's original field order, which is not necessarily sorted. If order matters, sort explicitly afterwards.
  • Nulls silently passing through. Null field values become null list items. Use List.RemoveNulls(Record.ToList([Rec])) if you want them gone.

Tips

  • Pair Record.ToList with Record.FieldNames when you need to line values up with their names later, since both follow the same field order.
  • Inside a custom column, you can combine it in one line: Text.Combine(List.Transform(Record.ToList([Rec]), each Text.From(_)), "; ").
  • If you need the values as columns instead of a list, Record.ToTable or expanding the record (click the expand icon in the column header) is usually cleaner.
  • To test the function quickly, create a blank query, open the Advanced Editor, and type Record.ToList([A=1, B=2, C=3]) — you should see {1, 2, 3}.

Troubleshooting

  • Expression.Error: We cannot convert the value to type Record. The input is not a record. Click the value in the preview to confirm its type; if it's a table, use Table.ToRecords first, and if it's a list, index into it to reach a record.
  • The name of the column was not found. Check spelling and capitalisation of the column or step name, and remember column references need square brackets.
  • The result shows "List" instead of values. That is normal — click the word List in the preview cell to see the items, or drill down / expand as needed before loading.
  • Errors after loading to a sheet. Lists cannot be loaded directly into an Excel table cell. Convert them first with Text.Combine, List.Count, or an indexer like {0}.
  • Values in the wrong order. The list mirrors the record's field order. Reorder fields with Record.ReorderFields before calling Record.ToList if you need a specific sequence.

Frequently Asked Questions

What does Record.ToList return?

A single flat list containing the values of every field in the record, in the record's own field order, with no field names.

Can I use Record.ToList on a table column of records?

Yes. Add a custom column and use Record.ToList([ColumnName]). Each row's record becomes its own list.

How is it different from Record.FieldValues?

They are functionally equivalent — Record.FieldValues is the older name and Record.ToList is the current documented name. Both return the list of values.

Does it work with nested records?

Yes, but nested records stay as records inside the list. You would need to call Record.ToList again (or expand) on those inner records to flatten fully.

How do I get field names as well as values?

Use Record.FieldNames for the names (same order) or Record.ToTable to get a two-column Name/Value table.