The M Code Behind the Power Query M function Soda.Feed

In order to fully utilize the Soda.Feed function, it is important to understand the M code that underlies it. In this article, we will break down the M code behind Soda.Feed and explore how it works.

Understanding the Soda.Feed Function

Before we dive into the M code behind Soda.Feed, it is important to understand what the function does. Essentially, Soda.Feed allows users to connect to a SODA API endpoint and import data into Power Query. The function takes two arguments: the URL of the SODA endpoint, and an optional options record that allows users to customize the import process.

Here is an example of how the Soda.Feed function might be used:


Source = Soda.Feed(“”),

#”Expanded Vehicles” = Table.ExpandRecordColumn(Source, “Vehicles”, {“id”, “make”, “model”, “year”}, {“”, “Vehicles.make”, “Vehicles.model”, “Vehicles.year”})


#”Expanded Vehicles”

In this example, we are importing data from the City of Chicago's SODA endpoint for vehicle crashes. We then expand the "Vehicles" column to create a more usable table.

Breaking Down the M Code

Now that we understand what the Soda.Feed function does, let's take a look at the M code that makes it work. Here is an example of the M code behind the function:


Source = Json.Document(Web.Contents(url, options)),

#”Converted to Table” = Record.ToTable(Source)


#”Converted to Table”

The M code for Soda.Feed is actually quite simple. The first step is to use the Web.Contents function to connect to the SODA endpoint. The URL for the endpoint is passed as the first argument to Soda.Feed. The second argument, options, is an optional record that can be used to customize the import process. We'll explore some of the options that can be used later in this article.

Once the data has been retrieved from the endpoint, it is converted to a Record using the Json.Document function. This allows us to work with the data more easily within Power Query. Finally, the Record is converted to a Table using the Record.ToTable function. This gives us a table that we can work with in Power Query.

Customizing the Import Process

As mentioned earlier, the Soda.Feed function allows users to customize the import process using an optional options record. Here are some of the options that can be used:

The Soda.Feed function in Power Query is a powerful tool for importing data from SODA API endpoints. By understanding the M code behind the function and the various options that can be used, users can fully leverage its capabilities. Whether working with government data or other types of data that use SODA, the Soda.Feed function is an invaluable resource for data analysts and data scientists alike.

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

Upcoming Courses

Contact Us


    Your Name (required)


    Email (required)


    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)