Smart Systems for Home

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

Power Query List.ConformToPageReader: How to Use It

· 6 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

List.ConformToPageReader is a Power Query function that converts a raw binary value (usually a PDF or document file) into a structured table by applying a page reader function you supply. In practice, you use it when you want to extract data from a file whose pages need custom parsing, such as a PDF where columns are separated by fixed positions or a document format that Power Query cannot read natively. The function does not parse anything by itself; it takes a binary and a reader function and returns a table. You need Power Query in Excel, Power BI Desktop, or a compatible service, a binary file, and a working reader function that accepts a binary page and returns a table.

What You'll Need

  • Power Query Editor open in Excel (Data > Get Data > Launch Power Query Editor) or Power BI Desktop (Home > Transform data). Menu labels can differ slightly by version, device, or region.
  • A source file loaded as a binary, for example via Data > Get Data > From File > From PDF, or a folder query that returns binary content.
  • A page reader function that takes a binary page and returns a table. This is usually a custom function you write or import, not a built-in function. If you do not have one, List.ConformToPageReader cannot do anything useful.
  • Basic familiarity with the Power Query formula language (M), because you will write or edit a formula in the formula bar or Advanced Editor.

Step-by-Step

  1. Load the file as a binary. In Power Query Editor, use Get Data to bring in your PDF or document. For a PDF, choose From PDF; Power Query will offer to navigate the file. Instead of navigating, keep the raw binary query. If you already have a query that returns binary content, select it.
  2. Create or obtain a page reader function. The reader must accept one binary argument (a single page) and return a table. A minimal example is a function that uses Pdf.Tables or another parser on that binary. Write it in a blank query via Home > New Source > Blank Query, then open Advanced Editor and define something like (page as binary) as table => .... Test it on a single page before using it with List.ConformToPageReader.
  3. Identify the list of pages. List.ConformToPageReader expects a list of binaries, not a single binary. If your source is one binary containing multiple pages, you first need to split it into a list of page binaries. How you do that depends on the file type and the reader function you are using. Many custom readers include a helper that returns a list of pages; use that helper rather than inventing a splitter.
  4. Call the function. In a new blank query, open Advanced Editor and write a formula in the form List.ConformToPageReader(pageList, readerFunction), where pageList is your list of page binaries and readerFunction is the name of your reader query. The function returns a table combining the results of the reader across all pages.
  5. Check the output. The result should be a table with the columns your reader function produces. If it returns a single column of tables or errors, the reader is not returning a table for each page, or the list is not a list of binaries.
  6. Expand and clean. Use the expand column icon or Table.ExpandTableColumn to bring the reader's columns into the main table. Then set data types, remove unused columns, and filter rows as needed.
  7. Load the result. Close and Load to a worksheet or data model, or apply changes in Power BI Desktop.

Common Mistakes

  • Passing a single binary instead of a list. List.ConformToPageReader expects a list. A single binary will produce an error or unexpected results.
  • Using a reader that returns something other than a table. The reader must return a table for each page. If it returns text, a record, or a list, the function will fail or produce unusable output.
  • Forgetting that the reader receives one page at a time. The reader should not try to read the whole document; it should parse the single binary it is given.
  • Assuming the function parses PDFs automatically. It does not. It only applies your reader function to each page. Without a working reader, it cannot extract anything.
  • Not handling errors per page. If one page fails, the whole query may fail. Wrap the reader in a try expression if you want to skip bad pages.

Tips

  • Test the reader function on a single page first. Once it returns the expected table, wrap it with List.ConformToPageReader.
  • Keep the reader function simple and focused on one page. Complex logic is easier to debug in isolation.
  • Use the formula bar to inspect the step. The Advanced Editor shows the full M code, which makes it easier to spot a missing list or a wrong function name.
  • If your source is a folder of PDFs, combine the binaries into a list before calling the function, or apply the function per file and then combine the results.
  • Document the reader function's expected input and output in a comment so future edits do not break the contract.

Troubleshooting

If you see an error such as "We cannot convert a value of type Binary to type List," you passed a single binary instead of a list. Check the first argument and make sure it is a list of binaries. If the error mentions the reader function, confirm the function name matches the query name exactly and that it accepts one binary argument. If the output table is empty, the reader may be returning an empty table for each page; test the reader on a known page. If only some pages fail, wrap the reader call in a try expression, for example try readerFunction(page) otherwise null, then filter out nulls. If the query is slow, reduce the number of pages or simplify the reader. If the function is not recognized, check that you are using a version of Power Query that includes it; it is available in current Excel and Power BI Desktop versions, but labels and availability can vary by version and region.

Frequently Asked Questions

What does List.ConformToPageReader actually do?

It applies a page reader function to each binary in a list and returns a table combining the results. It does not parse files on its own.

Can I use it without writing a custom function?

Only if you already have a reader function available. The function requires a reader; there is no built-in default reader that works for arbitrary files.

Does it work with PDFs in Excel and Power BI?

Yes, provided you supply a reader function that can parse a single PDF page binary. The function itself is part of the Power Query formula language and is available in both.

Why does my query return a column of tables?

The reader returned a table for each page and the results were not expanded. Use the expand column icon or Table.ExpandTableColumn to bring the columns into the main table.

How do I skip pages that fail?

Wrap the reader call in a try expression inside your reader function or in the call, then filter out the error or null values.

Is List.ConformToPageReader available in Power Query Online?

Availability can differ by environment and version. Check the function list in your Power Query editor; if it is missing, use the equivalent logic manually by transforming each page with your reader and combining the tables.