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 Automate / Formating and returnin...
Power Automate
Unanswered

Formating and returning a datatable from Desktop to Cloud

(1) ShareShare
ReportReport
Posted on by 12

I have a desktop flow running an SQL query with the "Execute SQL statement" action, and it is generating a Datatable with the resultset, which in turn is put in an output variable "Return".

 

The preview of the SQL result in a datatable looks good: Headers are there and data is well separated, even if it the data contains the comma separator symbol.

torkil_0-1647428408906.png

I assign this datatable to an output variable called "Return". 

 

When I trigger this desktop flow from a cloud flow, I get something that looks like CSV data in the JSON return body:

 

{
 "statusCode": 200,
 "headers": {...},
 "body": {
 "Return": "1234, John Doe, Main Street 1, 12345 Someplace\r\n1235, Jane Doe, Main Street 2, 12345 Someplace\r\n"
 }
}

 

Screenshot from Power Automate:

torkil_1-1647428711747.png

 

This CSV format in the returndata is useless of course, because commas appear both as data and as field separators, so when parsing this data I won't be able to separate the fields properly.

 

So I am wondering what are the best practices for returning a datatable (or table-like data if you will) from Desktop to Cloud, in a format less prone to errors? Preferably some way that also includes the column headers in the output?

I have the same question (0)
  • torkil Profile Picture
    12 on at

    I may be on to something. I tested inserting the data table into a custom object variable:

     

    SET ReturnObject TO {{ }}
    SET ReturnObject['Rows'] TO QueryResult
    Variables.ConvertCustomObjectToJson CustomObject: ReturnObject Json=> ReturnObjectAsJSON
    SET Return TO ReturnObjectAsJSON

     

    This, however, returns the data as JSON code as a string inside the JSON response:

     

    {
     "statusCode": 200,
     "headers": {...},
     "body": {
     "Return": "{\"Rows\":[{\"CustomerNumber\":1234,\"Name\":\"John Doe\",\"Address\":\"Main Street 1, 12345 Someplace\"},{\"CustomerNumber\":1235,\"Name\":\"Jane Doe\",\"Address\":\"Main Street 2, 12345 Someplace\"}]}"
     }
    }

     

    JSON is not as effective either, with the column header being repeated on every line it effectively increases the data size by a large percentage, at least for this example.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard