Table.ConformToPageReader

D

T

The M Code Behind the Power Query M function Table.ConformToPageReader

What is the Table.ConformToPageReader Function?

The Table.ConformToPageReader function is used in Power Query M to ensure that tables are formatted correctly for the page reader. Page readers are used to read data from a web page or document, and they have specific requirements for how data is formatted. The Table.ConformToPageReader function ensures that tables are formatted in a way that is readable by the page reader.

How Does the Table.ConformToPageReader Function Work?

The Table.ConformToPageReader function works by taking a table as input and returning a new table that conforms to the page reader’s requirements. The function works by analyzing the table and making changes to the formatting and structure of the table as necessary.

The Table.ConformToPageReader function performs several operations on the input table to ensure that it conforms to the page reader’s requirements. These operations include:

– Removing unnecessary columns

– Renaming columns to make them more readable

– Formatting columns to ensure that they are readable by the page reader

– Converting data types to ensure that they are compatible with the page reader

Examples of Using the Table.ConformToPageReader Function

Here are some examples of how you can use the Table.ConformToPageReader function in Power Query M:

Example 1: Removing Unnecessary Columns

Suppose you have a table with several columns, but you only want to display a few of them in the page reader. You can use the Table.ConformToPageReader function to remove the unnecessary columns. The code for this would look something like this:


let

Source = ,

ConformedTable = Table.ConformToPageReader(Source, {{"Column1", type text}, {"Column2", type number}, {"Column3", type text}}, true)

in

ConformedTable


In this example, the Table.ConformToPageReader function takes the input table (Source) and returns a new table (ConformedTable) that contains only the columns “Column1”, “Column2”, and “Column3”.

Example 2: Renaming Columns

Suppose the column names in your table are not reader-friendly. You can use the Table.ConformToPageReader function to rename the columns to make them more readable. The code for this would look something like this:


let

Source = ,

ConformedTable = Table.ConformToPageReader(Source, {{"Column1", type text}, {"Column2", type number}, {"Column3", type text}}, true, {"First Column", "Second Column", "Third Column"})

in

ConformedTable


In this example, the Table.ConformToPageReader function takes the input table (Source) and returns a new table (ConformedTable) that contains columns named “First Column”, “Second Column”, and “Third Column”.

Example 3: Formatting Columns

Suppose one of the columns in your table contains dates, but the page reader requires that dates be formatted in a specific way. You can use the Table.ConformToPageReader function to format the dates in the required format. The code for this would look something like this:


let

Source = ,

ConformedTable = Table.ConformToPageReader(Source, {{"Column1", type text}, {"Column2", type number}, {"Column3", type date}}, true, {"First Column", "Second Column", "Third Column"}, {"", "", "yyyy-mm-dd"})

in

ConformedTable


In this example, the Table.ConformToPageReader function takes the input table (Source) and returns a new table (ConformedTable) that contains the dates in the format “yyyy-mm-dd”.

The Table.ConformToPageReader function is a powerful tool in Power Query M that allows you to ensure that tables are formatted correctly for page readers. By using this function, you can remove unnecessary columns, rename columns, format columns, and convert data types to ensure that your tables are readable by page readers. With the help of the M code behind the Table.ConformToPageReader function, you can manipulate and transform your data to fit your needs.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)