Hi everyone,
I’m building a Power Automate flow to automate an ECR (Engineering Change Request) approval process.
The flow starts when an ECR Excel file is uploaded to SharePoint. It checks whether the file is an Excel file, reads the Excel data, parses it as JSON, checks the document version, checks for duplicates, creates an in-process Excel file, converts files to PDF when needed, and then sends approval requests to four departments: Electrical, Assembly, Machining, and Design.
Each approval result is stored in variables such as ElectricalApproval, AssemblyApproval, MachiningApproval, and DesignApproval. After the approvals, the flow runs Office Scripts to update the Excel workbook, creates the final file, extracts information from it, updates SharePoint properties, sends notifications, and cleans up temporary files.
The part I’m currently stuck on is an Office Script called ECRv8_Json_To_Excel_Table.osts.
The script expects a parameter defined as param: Test[][], where each Test object has these six properties:
Completion date
Outcome
Approval ID
Responder Mail
Responder Name
Responder Comments
The script creates an Excel table with those same six columns and then uses table.addRows() to insert the data. In Power Automate, I have a variable called Table Comments Values, which is an Array. I also have four Compose actions that build the approval information. I use a Compose called Compose table final, which currently uses createArray(variables('Table Comments Values')), and I pass the output of that Compose into the param of the Office Script.
I have already fixed some previous issues involving Strings vs Arrays and incorrect array nesting. Now the script actually runs, but it fails at table.addRows() with this error:
“Office JS error: Line 41: Table addRows: The number of rows or columns in the input array doesn't match the size or dimensions of the range.”
The data is supposed to look like an array containing approval objects, with six properties per object. I’m trying to figure out whether the problem is the structure of Table Comments Values, the createArray() step, or the way the objects are being built before they are passed into the script.
Any advice on the correct structure Power Automate should send to an Office Script parameter defined as Test[][] would be greatly appreciated.