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 Platform Community / Forums / Power Automate / How convert text to da...
Power Automate
Answered

How convert text to datatable?

(3) ShareShare
ReportReport
Posted on by 83

Hi 

 

I want to convert text to datatable

Please tell me how to do?

 

dominono9_0-1655610720460.png

↑ to ↓

dominono9_1-1655610766377.png

 

 

 

 

  

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Use loops, string functions, split, etc on your textlist variable.

    You have to form a string like %{ ^['ColumnName1', 'ColumnName2'], ['1', '2'], ['3', '4'] }%

     

    And then pass it to Set variable

     

    VJR_0-1655612691642.png

    The output of this set variable will be a datatable

     

    VJR_1-1655612739270.png

     

  • Verified answer
    AutomateWithDev Profile Picture
    30 on at

    Hi @dominono9 

     

    You can build a flow as shown below:

     

    AutomateWithDev_5-1655665722587.png

     

    Here, first I have created a data table with the column headers using the following expression in a 'Set Variable' action: 

     

    %{ ^['Column 1', 'Column 2', 'Column 3'] }%

     

     

    AutomateWithDev_8-1655665956476.png

     

     

    Then, I split my text into a list with New Line as separator using a 'Split Text' action to create a list with each of the row elements in the text file:

     

    AutomateWithDev_2-1655665530166.png

     

     

    Next I iterate within this list element and the again use a 'Split Text' action for splitting the current row item with a comma separator:

     

    AutomateWithDev_6-1655665773683.png

     

    For each iteration I will get a list called as TextList as shown below:

     

    AutomateWithDev_4-1655665649248.png

     

    Now, in the end I just use a 'Set Variable' action again to add a new datarow consisting of all the items in the newly generated list to my original data table variable with the following expression:

     

     

    %DataTable + [TextList[0], TextList[1], TextList[2]]%

     

    AutomateWithDev_7-1655665928041.png

     

    My final output is as shown below:

     

    AutomateWithDev_9-1655665986335.png

     

     

     

    ------------------------------------------------------------------------------------------------------------------------------

    If this post helps you with your problem, please mark your as Accepted solution. If you like my response, please give it a Thumbs Up.

    ------------------------------------------------------------------------------------------------------------------------------

  • dominono9 Profile Picture
    83 on at

    Thank you very much. I Understand!

  • GucluGunduz Profile Picture
    12 on at

    I have a variable number of data in my Excel table. While there are 11 data in some rows, there are 15 in others. If I keep the number low in the last "set variable" line where we print the data to the test lists, it does not include excess data, but if I make it high, this time it gives an empty directory error. how can i fix this

    Ekran görüntüsü 2024-02-08 162053.png

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 957

#2
Valantis Profile Picture

Valantis 847

#3
Haque Profile Picture

Haque 609

Last 30 days Overall leaderboard