How to insert a link to a cell from another workbook in a cell? What should be the format? I tried: #'[WorkbookName]sheetName'!D4
Asked
Active
Viewed 102 times
1 Answers
0
We could try to do that like below sample code, set the cell’s value with the formula which links to another workbook.
async function run() {
await Excel.run(async (context) => {
const range = context.workbook.getSelectedRange().getCell(0, 0); //replace the ‘teststyle.xlsx’ with the workbook name you will reference
range.values = [["=[teststyle.xlsx]Sheet1!$A$1"]];
await context.sync();
console.log("Set formula successfully!");
}); }

Jinghui-MSFT
- 121
- 4