Splitter.SplitTextByWhitespace Function in Power Query
The Splitter.SplitTextByWhitespace function in Power Query, returns a function that splits text into a list of text at whitespace.
Syntax
Splitter.SplitTextByWhitespace( optional quoteStyle as nullable number ) as function
Example:
Power Query M
// Start of the 'let' expression to define the transformation steps let // Step 1: Create a table called 'Source' using Table.FromRecords // Each record has one field named "Data" which is a string containing: // Student ID, Name, and Marks, all separated by whitespace Source = Table.FromRecords( { [Data = "1 Ashish 568"], [Data = "2 Katrina 855"], [Data = "3 Alia 380"], [Data = "4 Vicky 458"], [Data = "5 Mohini 278"], [Data = "6 Meenakshi 289"], [Data = "7 Esha 875"], [Data = "8 Anjali 380"] } ), // Step 2: Split the "Data" column into three new columns based on whitespace // This splits each string wherever there is space and assigns: // - First value to "Student ID" // - Second value to "Name" // - Third value to "Marks" return = Table.SplitColumn( Source, "Data", Splitter.SplitTextByWhitespace(), {"Student ID", "Name", "Marks"} ) // Final output of the transformed table in return
The output of the above code is shown in the image below:
