Excel Power Query Wrap Text: How to Do It

How-to basics · Updated November 22, 2026

The short answer: Power Query does not have a direct “wrap text” button, but you can force wrapped text in the final worksheet by using the Table.View trick or by applying wrap text after loading the data. The most reliable method is to load your query to a worksheet, select the columns, and click Home > Wrap Text in Excel. However, if you need the wrapping to persist automatically when you refresh the query, you must embed a formatting step using Table.View in the Power Query M language.

Why Power Query Doesn’t Have a Wrap Text Button

Power Query is a data transformation tool, not a formatting tool. Its purpose is to clean, shape, and combine data before it lands in Excel. Formatting—like font size, cell colors, and text wrapping—is considered presentation, which Excel handles after the data is loaded. That’s why you won’t find a “Wrap Text” option in the Power Query ribbon or in the Transform tab. The only formatting-related options in Power Query are data type changes (like text or number) and column width adjustments, which are also not persistent.

How to Wrap Text in the Loaded Data (Basic Method)

If you don’t mind re-applying wrap text after each refresh, the simplest approach is:

  1. Load your query to a worksheet (Home > Close & Load).
  2. Select the cells or entire columns that contain long text.
  3. Go to Home > Wrap Text in the Excel ribbon.
  4. Adjust row heights if needed—Excel usually auto-sizes rows when wrapping is on, but if you’ve manually set a row height, you may need to reset it.

This works fine for one-time reports. But if you refresh the query, the wrap text setting stays on the worksheet (since it’s a cell format), so it actually persists! The catch is that if your query adds new rows, those new rows will also have wrap text applied because the format extends to the entire column. So the basic method is often sufficient. The only time it fails is if you use “Load to” and choose “Only create connection”—then there’s no worksheet to format.

The Persistent Method: Using Table.View in M

If you need the wrap text to be applied automatically every time the query refreshes—for example, when sharing a workbook with colleagues who might not know to format—you can embed a formatting instruction in the M code. This uses a relatively obscure function called Table.View. Here’s a step-by-step example:

  1. In Power Query, create or edit your query.
  2. Go to Home > Advanced Editor.
  3. Find the last line of your M code, which typically looks like in #"Changed Type".
  4. Replace that final line with a Table.View expression that sets the wrap text property.

Here’s a concrete example. Suppose your query ends with a step named #"Changed Type". Replace the in line with:

in
    Table.View(
        #"Changed Type",
        [
            WrapText = (columnIndex) =
                let
                    columnName = Table.ColumnNames(#"Changed Type"){columnIndex},
                    shouldWrap = columnName = "Description" // wrap only the Description column
                in
                    shouldWrap,
            GetText = (columnIndex, rowIndex) =>
                Table.Cell(#"Changed Type", rowIndex, columnIndex)
        ]
    )

This code tells Excel to wrap text in the column named “Description” whenever the query loads. The WrapText function receives a column index (0-based) and returns true for the column you want wrapped. You can modify the condition to wrap multiple columns, e.g., shouldWrap = List.Contains({"Description", "Notes"}, columnName).

Important: This method works only when you load the query to a worksheet (not just a connection). Also, ensure your M code is valid—any syntax error will break the query. Test on a copy of your workbook first.

Choosing Which Columns to Wrap

Wrapping every column can make your sheet look messy. Here are factors to consider:

  • Text length: Wrap columns that contain sentences or long strings (e.g., comments, descriptions, addresses).
  • Numeric data: Never wrap numbers; they should stay in a single line for readability.
  • Column width: If you set a fixed column width, wrapping is essential to see the full text. If you auto-fit, wrapping may not be needed.
  • Print layout: Wrapped text increases row height, which affects print pagination. Plan accordingly.

Common Problems and Solutions

Here are issues users run into and how to fix them:

  • Wrap text doesn’t appear after refresh: If you used the basic method, check that the column format didn’t get reset. If you used Table.View, ensure the column name matches exactly (case-sensitive) and that you didn’t misspell WrapText.
  • Row height doesn’t auto-adjust: Excel auto-fits rows only if you haven’t manually set a row height. Select the rows and choose Home > Format > AutoFit Row Height.
  • Merged cells: Wrap text doesn’t work well in merged cells; avoid merging when you need wrapping.
  • Power Query editor shows no wrap: The wrap only applies to the final worksheet, not the query preview. That’s normal.
  • Error on load: If you get an error with Table.View, double-check the function syntax and that your query doesn’t have a column name mismatch.

Comparison: Power Query vs. Excel Formulas for Text Formatting

Power Query is not the only way to handle text. You can also use Excel formulas like =TEXTJOIN() or =CONCAT() to combine text, but they don’t control wrapping. If you only need to display long text from a cell, wrapping is a display property, not a data property. Power Query excels at cleaning text (removing extra spaces, splitting columns, etc.), but for wrapping, it’s purely a post-load format. In contrast, Google Sheets has a “Wrap text” option in the toolbar, but that’s also a display setting, not a data transformation.

Costs and Alternatives

There is no cost to using Power Query—it’s included with Excel 2016 and later, including Microsoft 365. If you don’t want to use M code, alternatives include:

  • Manual formatting: Just click Wrap Text after loading. Works fine for most cases.
  • VBA macro: Write a small macro that applies wrap text on refresh. For example, in the worksheet’s Worksheet_Change event or a refresh button.
  • Use Excel Tables: Convert your data to an Excel Table (Ctrl+T). Table styles can include wrap text formatting, which persists as new rows are added.
  • Power Pivot: If you’re using Power Pivot, you can’t wrap text in the data model—it’s a tabular cube, not a worksheet. You’d still need to load to a sheet.

Frequently Asked Questions

Does Power Query have a wrap text option?

No, Power Query does not have a wrap text button. You must apply wrap text in Excel after loading the data, or use the Table.View M function to embed the formatting instruction.

Will wrap text stay after refreshing the query?

Yes, if you apply wrap text to the worksheet cells, it stays after refresh because it’s a cell format. However, if you use “Only create connection”, there’s no cell to format. The Table.View method ensures wrapping is applied automatically on each refresh.

Can I wrap text in Power Query for a column with line breaks?

Yes, you can insert line breaks in the data itself using #(lf) in M, but that’s not the same as wrapping. To display those line breaks, you still need wrap text enabled in Excel. For example, to add a line break between first and last name, you could use = Text.Combine({[First], [Last]}, "#(lf)").

Why does my wrapped text get cut off in the Power Query preview?

Because Power Query preview is just a data grid, not a worksheet. It doesn’t apply any cell formatting. The preview may truncate long text, but that doesn’t affect the final output.

Is there a way to auto-fit row height after wrapping?

Yes, select the rows and go to Home > Format > AutoFit Row Height. Excel will adjust the row height to fit the wrapped text. This works for both manually formatted and Table.View-formatted cells.

Can I use wrap text in Power Query for a column that contains HTML or rich text?

Power Query treats all text as plain strings. If your column contains HTML tags, wrapping will display the tags as text. To strip HTML, you’d need to use a custom M function or load and then use Excel’s CLEAN function. Wrapping itself is independent of content type.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.