cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mgrachii
Resolver I
Resolver I

Office Script with Input Parameters and Object Outup

Hi,

I am using Office Scripts to return data to power automate, they work great if the return data type is string or number. When I try to return an object, (eg JSON), the script goes crazy and my input parameters are no longer recognized. If i stringify the JSON and return as string it works. Do you know if this is a known issue with Object responses? or am I doing something wrong

 

My script receives 2 JSON parameters, then process this data and returns something back to me in Power Automate.

 

This works:

function main(workbook: ExcelScript.Workbook, projectsJSON: ProjectsInterface[], tasksJSON: TasksInterface[]😞 string {
Power Automate prompts properly my parameters and runs with no issues, returns string perfectly

mgrachii_1-1635185005777.png

 

 
This makes my script parameters to desapear from Power Automate interface:
function main(workbook: ExcelScript.Workbook, projectsJSON: ProjectsInterface[], tasksJSON: TasksInterface[]): object {
mgrachii_2-1635185019450.png

My input parameters are no longer prompted (and I get the error below)

mgrachii_3-1635185077086.png

 

 

1 REPLY 1
Random1231
Frequent Visitor

Hi mgrachii,

Try to NOT define the return type of your function and return whatever you should. It works for me.

(workbook: ExcelScript.Workbook, projectsJSON: ProjectsInterface[], tasksJSON: TasksInterface[]) {
...
  return { "whatever" : "whatever", .... };
}

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,604)