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 Apps / Create json with all i...
Power Apps
Answered

Create json with all items from a gallery

(0) ShareShare
ReportReport
Posted on by 88

I try to build a json file with content of alle items in a gallery.

 

The purpose is to send content from a gallery to Power Automate, so I can generate a Excel file with the content from a gallery and send it to a user.

 

I have tried a lot of ways, but nothing works.

 

I have previously used this so send a single element to flow:

 

ClearCollect(
Collection3,
{Manager: Manager.Selected.Value,
MLPCourse: MlpCourse.Selected.Value,
Team: Team.Selected.Value,
AddToCourse: AddToCourse.Selected,
CreateCourse: CreateCourse.Text,
AddToTitle: AddToTitle.Text,
DueDateNew: DueDate3.Selected.Value,
DueDateMLP: DueDate1.Selected.Value,
AddInfo: AddInfo.Text
});
CreateMLPCourseToTeams_v4.Run(JSON(Collection3,JSONFormat.IndentFour));
Navigate(Screen2)

 

But I can´t find a way to select all items from a gallery

Categories:
I have the same question (0)
  • Verified answer
    dinusc Profile Picture
    Microsoft Employee on at

    Hello @torbenbj ,

    I hope this helps: https://www.youtube.com/watch?v=QTbVMu6DIfQ

  • torbenbj Profile Picture
    88 on at

    Hi Dinesc

     

    Thank you very much. It was exactly what I was looking for.

     

    Do you know if it´s possible to configure the CSV-file with Headlines and other information like a sum value from a flow variable?

     

    TorbenBj

  • Verified answer
    dinusc Profile Picture
    Microsoft Employee on at

    I would handle all the calculations in PowerApps as opposed to delegating that to the flow. You should be able to add all the required fields in the original PowerApps collection.

  • torbenbj Profile Picture
    88 on at

    Hi Dinucs,

     

    Thank you very much.

     

    Only one question left :-).

     

    When I export to csv everything looks right beside one thing.

     

    From line 31 in the report - when I open in ecxel, the first column is excluded. Looks stange! I tried to change the limit of numbers from 30 to 300 in the SP view - but the same.

    img2.PNG
  • Verified answer
    dinusc Profile Picture
    Microsoft Employee on at

    Is highlighted information from the attached picture where the issue is? I can see the extra delimiters ";" is that to account for empty column or is a part of data?

    Either way, I suspect the issue is with delimiter characters that are a part of the data. For example, imagine the following 2 fields: {"Your Name": "John Smith", "Company Full Name": "Abc, Inc."}. When doing a naive conversion to CSV, it may happen that this will be split into 3 values causing issues with missing/extra columns. Good CSV converters will handle the export properly in this case. The one provided in this thread however will probably not. I would suggest to escape the delimiters in the PowerApps. You can then restore them later. In the example above, you can replace all the commas (or ";" in your case) with pipes ("|" for example) in PowerApps, before exporting to CSV.

  • torbenbj Profile Picture
    88 on at

    Hi Dinusc,

     

    Thanks for leading me to the right direction...

     

    The solution was to change like this:

     

    This works:

    ClearCollect(ExportCSVCol,"");Set(ExportCSV,"");ForAll(BrowseGallery1.AllItems,Collect(ExportCSVCol,{DateVa:Text(CurDate),OE1Va:Text(OE1),OE2Va:Text(OE2),CourseNameVa:Text(CourseName)}));Set(ExportCSV,Concat(ExportCSVCol,DateVa&","&OE1Va&","&OE2Va&","&CourseNameVa&","&Char(10)));

    Set(SuccessVar,BDOOEExport.Run("User().Email",ExportCSV,User().Email,Sum(BrowseGallery1.AllItems,OE_Cat_1)).completed)

     

    This coursed the issue:

    ClearCollect(ExportCSVCol,"");

    Set(ExportCSV,"");

    ForAll(BrowseGallery1.AllItems,Collect(ExportCSVCol,{DateVal:CurDate.Text,OE1Val:OE1.Text,OE2Val:OE2.Text,CourseNameVal:CourseName.Text}));

    Set(ExportCSV,Concat(ExportCSVCol,DateVal&";"&OE1Val&";"&OE2Val&";"&CourseNameVal&";"&Char(10)));

    Set(SuccessVar,BDOOEExport.Run("User().Email",ExportCSV,User().Email,Sum(BrowseGallery1.AllItems, OE_Cat_1)).completed)

     

    So this format for each column: DateVa:Text(CurDate) and not like this DateVal:CurDate.Text

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard