File.Contents

File.Contents

D

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

In this article, we’ll take a closer look at the M code behind `File.Contents`. We’ll explore how the function works, how it’s used in Power Query, and how you can modify the code to suit your needs.

Understanding the File.Contents Function

At its core, `File.Contents` is a simple function. It takes a single argument, which is the path to the file you want to read. When you call the function, it reads the contents of the file and returns a table with a single column containing the file’s contents.

Here’s an example:


let

Source = File.Contents(“C:UsersJohnDoeexample.txt”)

in

Source


In this example, we're using `File.Contents` to read the contents of a file named "example.txt" located on the "C:UsersJohnDoe" directory. The function reads the file's contents and returns a table with a single column containing the contents of the file.

The M Code Behind File.Contents

To understand how `File.Contents` works

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: