Guid.From

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

Let’s examine a few examples on using the Guid.From function.

You can supply a GUID as 32 consecutive hexadecimal digits:

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

Alternatively, you can divide the GUID into blocks of 8-4-4-4-12 digits, separated by hyphens:

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

You can also provide the GUID as 32 hexadecimal digits, separated by hyphens and enclosed in curly brackets:

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

And finally, the GUID can be given as 32 hexadecimal digits, separated by hyphens and enclosed by parentheses:

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

All in all, the Guid.From function converts text into a Guid.Type value. It supports a wide range of acceptable formats giving you flexibility while handling GUIDs in your data operations.

Other functions related to Guid.From are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/guid-from
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.