web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : uelAMitc5n5jbtQYDB+K0b
Power Automate - General Discussion
Unanswered

Write an array in an Excel range with Office Scripts

Like (0) ShareShare
ReportReport
Posted on 18 Apr 2024 21:45:04 by 2,291

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.

 

 

 

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 626 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 374 Moderator

#3
Expiscornovus Profile Picture

Expiscornovus 284 Most Valuable Professional

Last 30 days Overall leaderboard