Copy and paste using Office script

Lyndsey Blair 11 Reputation points
2022-05-16T16:07:37.18+00:00

Hello! I have a table and I want to copy the values from cells E2:E66 and paste them into B2:B66 using an office script. However, the below code is copying and pasting the values from E2:E66 into A1:A65.

function main(workbook: ExcelScript.Workbook) {
let hardin = workbook.getTable("Hardin");
//set range on hardin
hardin.getRange("B2:B66")
// Paste range at B2:B66 from E2:E66
hardin.getRange("B2:B66").copyFrom("E2:E66", Excel.RangeCopyType.values);
}

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.