Value.FromText Function in Power Query
The Value.FromText function in Power Query is used to convert text into a value of the appropriate type, such as number, logical (true/false), date, or null based on the content of the text.
Syntax
Value.FromText(text as any, optional culture as nullable text) as any
The function has the following parameters:
- text – The text string you want to convert.
- culture – It is an optional parameter. A culture code (like "en-US" or "fr-FR") to interpret numbers, dates, etc. correctly according to locale.
Example: Convert Text to Number.
Power Query M
let Source = Value.FromText("123"), return = Value.Type(Source) in return
The output of the above code is number.
Example: Convert Text to Boolean.
Power Query M
let Source = Value.FromText("true"), return = Value.Type(Source) in return
The output of the above code is logical.