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 / Write an array in an E...
Power Automate
Unanswered

Write an array in an Excel range with Office Scripts

(0) ShareShare
ReportReport
Posted on by 2,297

Hello,

 

This is myArray in Power Automate:

 

 

[
 "Code A, ,3000000,30,True",
 "Code B, ,1000000,20,True"
]

 

 

I want to write this array in cell A1, of an Excel workbook.

 

This is my script:

 

 

function main(workbook: ExcelScript.Workbook, wsName: string, strArr: string) {

 //Convert the strArr to an array
 let newDataArr: string[][] = JSON.parse(strArr);

 console.log(newDataArr);
 //Declare and assign the worksheet
 let ws = workbook.getWorksheet(wsName);
 let startCell = ws.getRange("A1");
 startCell.getAbsoluteResizedRange(newDataArr[0].length, newDataArr.length).setValues(newDataArr);
}

 

 

 

Which is returning the error:

 

 

Office JS error: Line 19: Range setValues: the argument is invalid.

 

 

 

Categories:

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 349 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard