web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Text to Columns

(2) ShareShare
ReportReport
Posted on by 158
Hello, 
 
I am trying to launch an excel document, read the excel document and split a cell based on a special character (text to columns). I cannot figure out how to implement this piece. Could someone please help me?
 
Thank you,
 
Khrystina
I have the same question (0)
  • Suggested answer
    Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at
    Hi  ,
     
    Could you please share a screenshot of your Excel file to show how it looks? Additionally, could you share the desired output format?
     
    Regards,
    Deenu
     
     
  • KhrystinaM Profile Picture
    158 on at
    I'm trying to separate the text in column a at the | and adding it to column B. 
     
  • Suggested answer
    eetuRobo Profile Picture
    4,537 Super User 2026 Season 1 on at
    There might be a cleaner way with less actions but here is how I got that to work:


    Result:


    Code:
    File.ReadTextFromFile.ReadTextAsList File: $'''C:\\Users\\YourPath\\File.txt''' Encoding: File.TextFileEncoding.UTF8 Contents=> FileContents
    Text.Replace Text: FileContents TextToFind: $'''(?<=\\|)[^\\r\\n]*''' IsRegEx: True IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> aColumn
    Text.Replace Text: aColumn TextToFind: $'''|''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> aColumn
    Text.Replace Text: FileContents TextToFind: $'''.*(?=\\|)''' IsRegEx: True IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> bColumn
    Text.Replace Text: bColumn TextToFind: $'''|''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> bColumn
    Text.SplitText.Split Text: aColumn StandardDelimiter: Text.StandardDelimiter.NewLine DelimiterTimes: 1 Result=> Alist
    Text.SplitText.Split Text: bColumn StandardDelimiter: Text.StandardDelimiter.NewLine DelimiterTimes: 1 Result=> Blist
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: Alist Column: $'''A''' Row: 1
    Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: Blist Column: $'''B''' Row: 1
    
     EDIT:
    This way also works:


    aColumn Regex: (?<=\|)[^\r\n]*
    bColumn Regex: .*(?=\|)

  • KhrystinaM Profile Picture
    158 on at
    What did you put in the Relace with field? Your screenshot looks like it's a space or empty, but my system is not letting me do that. 
     
  • Suggested answer
    eetuRobo Profile Picture
    4,537 Super User 2026 Season 1 on at
    In Power Automate Desktop empty syntax is %''%
    Also remember to toggle on "Use regular expression for find and replace" since this is regex we are using and not plain text.


    Also if you use the second approach Remove item from list (remove all empty items so With value: %''%) remember to turn on "On error" and "Continue to next action"
     


     

     
    This way if there is no empty items it wont fail. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 707

#2
Haque Profile Picture

Haque 475

#3
Valantis Profile Picture

Valantis 456

Last 30 days Overall leaderboard