Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Transform Excel Table to a JSON with an embedded Array / Repeatgroup

(0) ShareShare
ReportReport
Posted on by 6

Hi Guys... I try to make it really short.

 

I am trying to come from

-> this Excelfile:

https://i.imgur.com/Y0aKWmu.png

 

-> To this JSON File: 

{
"No" : "1",
"Task" : "Clean House",
"Description" : "Cleaning",
"Repeatgroup": [
	{
	"Subtask_Location": "X",
	"Subtask_Content": "X",
	"Subtask_Status": "X"
	},
	{
	"Subtask_Location": "Y",
	"Subtask_Content": "Y",
	"Subtask_Status": "Y"
	},
	{
	"Subtask_Location": "Z",
	"Subtask_Content": "Z",
	"Subtask_Status": "Z"
	}
 ],
"Date" : "11/04/19",
"Time" : "00:00"
}

 

My Problem is, that I don't know how to build the Repeatgroup of the JSON file.

  • The reference/indicator is the "No" Field in the Excel-File...
  • So the Values of the 3 "Subtask_..."-Columns need to get written as the Repeatgroup, because of the same "No." (First column) as an indicator...

 

I hope I explained it good. Sorry for bad english, not a native speaker...

 

ANY Help is appreciated very much... For fast and effective help I will give out Tip-Money, since I am so clueless right now and need this to be done. :)) Thank you in Advance

  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: Transform Excel Table to a JSON with an embedded Array / Repeatgroup

    Hi @Julian1,

     

    I create a whole Flow process that gets the row of Excel file, then create a JSON file for each No.

    For the Repeatgroup, you could initialize a variable named Repeategroup, and you can see more details on step 4:

     

    This is my whole steps of the Flow:

    image 1: all steps

    Annotation 2019-09-26 153440.pngimage 2: all stepsAnnotation 2019-09-26 153609.png

    Step 1: (image 1)

    Initialize variables Clean (to store JSON data), Repeatgroup (to store repeat group) and ALLNo ( to store ALL No, including repeat No), then get the list rows present in a table.

    Step 2: (image 2)

    Add apply to each and Append to array actions to get the all No of the rows

    Step 3: (image 3)

    Add expression union(variables('ALLNo'),variables('ALLNo')) into the Big Apply to each No action to get each No and loop it. Then add Apply to each row of table action to get all rows with the same No, append the Repeategroup. After that, we can get Repeategroup array like:

    [
    	{
    	"Subtask_Location": "X",
    	"Subtask_Content": "X",
    	"Subtask_Status": "X"
    	},
    	{
    	"Subtask_Location": "Y",
    	"Subtask_Content": "Y",
    	"Subtask_Status": "Y"
    	},
    	{
    	"Subtask_Location": "Z",
    	"Subtask_Content": "Z",
    	"Subtask_Status": "Z"
    	}
     ]

    Image 3:

    Annotation 2019-09-26 153741.png

    Step 4: (image 4)

    Add Apply to each row of table-2 action to get rows with same No, set the clean variable as below, since the date in Excel file will return a number that since 1899-12-30, so we should use the addDays function to get the right format:

    addDays('1899-12-30', int(item()?['Date']), 'yyyy-MM-dd')

    Then create JSON file.

    Image 4: 

    Annotation 2019-09-26 153804.png

     

    Step 5:

    After creating a JSON file with the same No, empty the variable Clean and Repeatgroup.Annotation 2019-09-26 153842.png

    For the situation that step 4 will fail when some date value is empty, so we should configure the Set variable Repeategroup Null action setting as when the previous step has failed:Annotation 2019-09-26 160721.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1