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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Convert Collect...
Power Automate
Unanswered

How to Convert Collection to CSV file

(0) ShareShare
ReportReport
Posted on by 825

Hi All, 

I'm trying to create a flow using power apps and power automate, how ever  I tried to find some solution using the forum and google posts but I'm unable to figure out what ways can the object be converted to Json, as the error says expected Object but received string. 

The workflow goes as such, 

Firstly, I'm creating a collection in power apps, and sending all that collection to flow and then converting it to CSV and adding that to the SharePoint document folder. I tried it to do this step by step it by first get the data from power apps and use COMPOSE action to create a Schema, and then add to Parse JSON but i get the error saying expected Object but received Array. 

Can anyone give me any idea what I m doing wrong or missing the key factor here? Thank you all experts in advance. 🙂
Please see the screen shot below: 

Tapesh_0-1605611463542.png

Tapesh_1-1605611491278.png

Also, it is trying to create multiple files for the collection whereas I want to create one file for each one when the flow triggers.  

Tapesh_2-1605611573687.png

 





Thanks 

 

 

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at
    Re: How to Convert Collection to CSV file

    Hello @Tapesh 

    We need more information to help you. Could you share the expression in the compose action and the parse json one?

    What kind of information are you sending from Power Apps to Power Automate?

    Regards,

    Ferran

  • Tapesh Profile Picture
    825 on at
    Re: How to Convert Collection to CSV file

    Hi @fchopo , 

    Please find the details as per the request,
    From Power Apps, ON select button event, 
    I'm sending the collection converting it into a JSON format using FormatJson formula. 

    Clear(ExportColGal4);
    
    ForAll(Gallery4.AllItems, Collect(ExportColGal4, { CustID: Text(Gal4ACustId.Text), EmpName:Gal4Name.Text, EmailOfApprover: Gal4ApproverEmail.Text, UnitName: Gal4UnitName.Text, GrandTotal: Gal4WeeklyTotal.Text, ItemGlCode: Gal4GLcode.Text, ItemDescription: Gal4Description.Text, PurcahseDate: Gal4P_Date.Text, PerTransactionTotal: Gal4DayTotal.Text }));
    
    Set(VarFormatJSON, JSON(ExportColGal4, JSONFormat.IndentFour));
    
    NewExportCSVFlow.Run(VarFormatJSON, "");

    On Flow Trigger event in Compose Action: JUst asking for the input from powerapps using the above formula. 

    Tapesh_0-1605619717776.png

    ON Parse Action in flow, Im using the output from Compose Action and the schema is been taken form the output of compose action as well which is as mentioned below; 

    Tapesh_1-1605619848117.png

     

     

    JSON Schema:

    {
     "type": "array",
     "items": {
     "type": "object",
     "properties": {
     "CustID": {
     "type": "string"
     },
     "EmailOfApprover": {},
     "EmpName": {},
     "GrandTotal": {},
     "ItemDescription": {},
     "ItemGlCode": {},
     "PerTransactionTotal": {},
     "PurcahseDate": {},
     "UnitName": {}
     },
     "required": [
     "CustID",
     "EmailOfApprover",
     "EmpName",
     "GrandTotal",
     "ItemDescription",
     "ItemGlCode",
     "PerTransactionTotal",
     "PurcahseDate",
     "UnitName"
     ]
     }
    }





    And then Creating A CSV table as shown in the above screenshot of this post images using AUTOMATIC COLUMNS option

    Thanks in advance for your help. 🙂 @fchopo 


  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at
    Re: How to Convert Collection to CSV file

    Hello @Tapesh 

    I created a test flow to figure out your problem, but it is workin smoothly. Have a look:

    parsejson.png

     

    It is creating a CSV table nicely, so maybe your problem is in the format of the data. In my sample data, everything is a string.

    Probably we need to have a look at the format of the JSON data coming from PowerApps.

    Hope it helps!

    Ferran

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard