Search code examples
jsonexceldatatablepower-automate-desktop

Power Automate Desktop - Convert a data table (with multiple rows) to JSON


I've been researching the best way to convert a data table from excel (with multiple rows) to JSON.

I found a solution on here that appears to "mostly" work, but I am not familiar with JSON to know if it's converting multiple rows correctly.

Here is the data table that I am starting with (from excel)

Data table from Power Automate Desktop

Here are the steps I took to convert this to JSON

Step 1: Set variable called INVObject to be empty to initialize it Initialize Variable Image

Step 3: Added a For each to loop through each Data Row in the Data Table

Step 4: Added a Set Variable to set the INVObject (Custom Object) to the Data Table for each loop in the For each

For each and Set Variable after each loop image

Step 5: Convert the Custom Object INVObject to JSON Convert to JSON image

Results: There is one row/object with all 3 rows from the Data table on the same row Results Image

If you scroll to the right, the 2nd row eventually starts and then the 3rd row.

I was expecting to see 3 lines/rows/object to represent the 3 different rows in the Data table.

Can someone provide some insight as to if I am doing something wrong or if this is the expected results for multiple rows?

Thank You!


Solution

  • There is an option in Actions under Variables: 'Convert Custom Object to JSON'

    https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/variables#convertcustomobjecttojson