1

I'm very new to office scripts. I have 1-Dimensional array that I want to paste in a range, but I'm getting the error

Line 7: Range setValues: The argument is invalid or missing or has an incorrect format.

I've found that the expected array should be of 2 dimensions like in this thread, but I don't know how to fix it in my case. Thanks for any help.

This is my current script.

function main(workbook: ExcelScript.Workbook) {

    const arr: number[] = [201, 106, 95];

    let destRange = workbook.getActiveWorksheet().getRange("A1:A3");

    destRange.setValues(arr);

}

1 Answer 1

1

You need to convert it to a 2-D array:

const twoDArray = arr.map(value => [value]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.