Guid.From

Updated on

Guid.From is a Power Query M function that converts a given value into a Guid.Type value, if the value is in an acceptable format. The function returns the Guid.Type value or null if the input is null.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Guid.From( value as nullable text ) as nullable text

Description

The Guid.From function takes a string (which can be null) as input and converts it into a Guid.Type value. If the input is null, Guid.From conveniently returns a null value.

The function checks the format of the provided input value. For the operation to be successful, the input must adhere to an acceptable format, which we will explore in our examples.

Examples

A Guid (Globally Unique Identifier) can be formatted in various ways. Below are different examples of how a Guid can be supplied to the Guid.From function in Power Query M.

1. Contiguous Hexadecimal Digits

You can provide the Guid as a continuous string of 32 hexadecimal digits.

// Output: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Guid.From( "A1B2C3D4E5F67890ABCDEF1234567890" )

2. Hexadecimal Digits Separated by Hyphens

Another option is to separate the 32 hexadecimal digits with hyphens, grouping them into blocks of 8-4-4-4-12.

// Output: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Guid.From( "A1B2C3D4-E5F6-7890-ABCD-EF1234567890" )

3. Hexadecimal Digits with Hyphens and Braces

You can also enclose the hyphen-separated hexadecimal digits in braces.

// Output: "05fe1dad-c8c2-4f3b-a4c2-d194116b4967"
Guid.From( "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}" )

4. Hexadecimal Digits with Hyphens and Parentheses

Lastly, the hyphen-separated hexadecimal digits can be enclosed in parentheses, with optional spaces.

// Output: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Guid.From("(A1B2C3D4-E5F6-7890-ABCD-EF1234567890)")

Other functions related to Guid.From are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/guid-from

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy