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

The Guid can be provided as 32 contiguous hexadecimal digits.

// Output: "05fe1dad-c8c2-4f3b-a4c2-d194116b4967"
Guid.From( "05FE1DADC8C24F3BA4C2D194116B4967" )

The Guid can be provided as 32 hexadecimal digits separated by hyphens into blocks of 8-4-4-4-12.

// Output: "05fe1dad-c8c2-4f3b-a4c2-d194116b4967"
Guid.From( "05FE1DAD-C8C2-4F3B-A4C2-D194116B4967" )

The Guid can be provided as 32 hexadecimal digits separated by hyphens and enclosed in braces.

// Output: "05fe1dad-c8c2-4f3b-a4c2-d194116b4967"
Guid.From( "{05FE1DAD-C8C2-4F3B-A4C2-D194116B4967}" )

The Guid can be provided as 32 hexadecimal digits separated by hyphens and enclosed by parentheses.

// Output: "05fe1dad-c8c2-4f3b-a4c2-d194116b4967"
Guid.From( "( 05FE1DAD-C8C2-4F3B-A4C2-D194116B4967 )" )

Other functions related to Guid.From are:

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