cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Create table from csv string

Hi!

I hope someone can help me with this:

I am importing data from an Azure runbook into PowerApps by using Power Automate. The output i get looks like this:

Header1,Header2,Header3,Header4

Value1,Value2,Value3,Value4 ...and so on

Now I need it to be formatted as a table to be able to present it in a nice way.

I've been trying to use the Split function but I wont get it in the way I want.

Any Ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

@Jeff_Dalton 

Suppose you have a CSV string like this:

Set(myCSV,
    "Header1, Header2, Header3, Header4
    Value1, Value2, Value3, Value4
    Value5, Value6, Value7, Value8
    Value9, Value10, Value11, Value12"
);

 

Use this code:

ClearCollect(myTable,
    Split(myCSV, Char(10))
);
Clear(myTable2);
ForAll(
    myTable,
    Collect(myTable2, 
        {
            Heading1: First(Split(Result,",")).Result,
            Heading2: Last(FirstN(Split(Result,","),2)).Result,
            Heading3: Last(FirstN(Split(Result,","),3)).Result,
            Heading4: Last(Split(Result,",")).Result}
        )
);

 

To get this result:

pic3.png

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

@Jeff_Dalton 

Suppose you have a CSV string like this:

Set(myCSV,
    "Header1, Header2, Header3, Header4
    Value1, Value2, Value3, Value4
    Value5, Value6, Value7, Value8
    Value9, Value10, Value11, Value12"
);

 

Use this code:

ClearCollect(myTable,
    Split(myCSV, Char(10))
);
Clear(myTable2);
ForAll(
    myTable,
    Collect(myTable2, 
        {
            Heading1: First(Split(Result,",")).Result,
            Heading2: Last(FirstN(Split(Result,","),2)).Result,
            Heading3: Last(FirstN(Split(Result,","),3)).Result,
            Heading4: Last(Split(Result,",")).Result}
        )
);

 

To get this result:

pic3.png

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted

Thanks a lot! This was exactly what i wanted.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,254)