Exchange.Contents

D

T

The M Code Behind the Power Query M function Exchange.Contents

Introduction to Exchange.Contents

Exchange.Contents is a Power Query M function that allows users to connect to web data sources and extract data from them. It is a versatile function that can be used to connect to a wide range of web data sources, including web pages, web services, and other web-based data sources. The function takes a URL parameter as input and returns a table of data that represents the data on the web page or other data source.

Understanding the M Code Behind Exchange.Contents

To fully understand the M code behind Exchange.Contents, we need to understand how web data sources work. Web data sources are typically accessed using web protocols such as HTTP or HTTPS. When a user enters a URL into a web browser, the browser sends a request to the web server that hosts the data source. The server then responds with a web page or other data that represents the data on the data source.

The Exchange.Contents function works in a similar way. When the function is called with a URL parameter, it sends a request to the web server that hosts the data source, and the server responds with data that represents the data on the data source. The data is then converted into a table format and returned as output.

Using Exchange.Contents to Extract Data from Web Data Sources

Exchange.Contents can be used to extract data from a wide range of web data sources. Some examples of web data sources that can be accessed using Exchange.Contents include:

– Web pages: Exchange.Contents can be used to extract data from web pages, including tables, lists, and other types of data.

– Web services: Exchange.Contents can be used to extract data from web services that provide data in JSON, XML, or other formats.

– FTP sites: Exchange.Contents can be used to extract data from FTP sites that provide data in text, CSV, or other formats.

To use Exchange.Contents to extract data from a web data source, you need to provide the URL of the data source as input. For example, the following M code can be used to extract data from a web page:


let

Source = Exchange.Contents(“https://www.example.com”),

#”Extracted Table” = Source{[Name=”table1″]}[Data]

in

#”Extracted Table”


This code uses the Exchange.Contents function to connect to a web page located at https://www.example.com. The function then extracts data from the table named "table1" on the page and returns it as a table.

Exchange.Contents is a powerful function that allows users to extract data from web data sources using Power Query. By understanding the M code behind the function, users can connect to a wide range of web data sources and extract data in a variety of formats. Whether you are working with web pages, web services, or FTP sites, Exchange.Contents can help you extract the data you need for your analysis.

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)