Guid.From
TextReturns a validated and normalized GUID text value from the given text representation.
Syntax
Guid.From(value as nullable text) as nullable textParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | text | Yes | A text value representing a GUID. May include or omit hyphens, and may use uppercase or lowercase hex digits. |
Return Value
text — A normalized GUID string in lowercase format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or null if value is null.
Remarks
Guid.From parses and normalizes a text value into a standard GUID (Globally Unique Identifier) format. The output is always lowercase with hyphens in the standard xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx form, regardless of how the input was formatted. This makes it the correct tool for standardizing GUID columns loaded from external sources that may store them inconsistently.
If value is null, the function returns null. If value is not a valid GUID representation, an error is raised — so use try Guid.From(...) or validate inputs when working with potentially dirty data.
Accepted input formats include:
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" — 32 hex digits, no hyphens
- "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" — standard format with hyphens
- "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" — with curly braces
Use Guid.From to normalize GUID join keys before merging queries. If two tables store the same GUID in different formats (one with hyphens, one without), a plain merge will fail to match rows — normalizing both sides with Guid.From first resolves this. For generating new GUIDs at query time, use Text.NewGuid instead.
Examples
Example 1: Normalize an uppercase GUID to standard format
Guid.From("A3F8C2D1-4B7E-4F2A-9C6D-1E8B3A5F0D72")Result | |
|---|---|
| 1 | a3f8c2d1-4b7e-4f2a-9c6d-1e8b3a5f0d72 |
Example 2: Parse a GUID stored without hyphens
Guid.From("a3f8c2d14b7e4f2a9c6d1e8b3a5f0d72")Result | |
|---|---|
| 1 | a3f8c2d1-4b7e-4f2a-9c6d-1e8b3a5f0d72 |
Example 3: Normalize a GUID column in a table for reliable merging
let
rawIds = #table({"RawID"}, {
{"A3F8C2D1-4B7E-4F2A-9C6D-1E8B3A5F0D72"},
{"b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6"},
{null}
}),
normalized = Table.TransformColumns(rawIds, {{"RawID", Guid.From, type nullable text}})
in
normalizedThe final output — all RawID values normalized to lowercase hyphenated GUID format using Guid.From; the null value is preserved as null.
RawID | |
|---|---|
| 1 | a3f8c2d1-4b7e-4f2a-9c6d-1e8b3a5f0d72 |
| 2 | b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6 |
| 3 | null |