type Getitem("Sheet4"). This snippets works.
But change to *worksheets.getActiveWorksheet()* methods then the whole snippet not work.
Так в чем разница между getitem и getactiveworksheet.
await Excel.run(async (context) => {
let sample = context.workbook.worksheets.getItem("Sheet4");
let sourcerange = sample.getRange("C1");
sourcerange.load("format/fill/color, format/font/name, format/font/color");
return context.sync().then(function() {
var targetrange = sample.getRange("c6").getSurroundingRegion();
targetrange.set(sourcerange);
return context.sync();
});