2

Next example gives me "Sheet1!C3":

Excel.run(function (ctx) { 
    var sheetName = "Sheet1";
    var worksheet = ctx.workbook.worksheets.getItem(sheetName);
    var cell = worksheet.getCell(3,3);
    cell.load('address');
    return ctx.sync().then(function() {
        console.log(cell.address);
    });
}).catch(function(error) {
        console.log("Error: " + error);
        if (error instanceof OfficeExtension.Error) {
            console.log("Debug info: " + JSON.stringify(error.debugInfo));
        }
});

It is possible to get full address like "Sheet1!C3:E4" using start and end row and column numbers ?

Alex K
  • 2,613
  • 1
  • 20
  • 31

1 Answers1

5

Yes, there are a few ways: You can either use the following if you want to combine 2 specific cell addresses:

var newrange = worksheet.getCell(0, 0).getBoundingRect(worksheet.getCell(5, 5));

Or you can get a range and then resize it (where the parameters are the delta by how many rows/columns you want to increase/decrease it):

var newrange = worksheet.getCell(0, 0).getResizedRange(5, 5);
Philip Rueker
  • 948
  • 5
  • 15
  • Thanks for this suggestions! I was really searching for it on the Microsoft documentation. I used the first one and it works like a charm! – g00golplex Nov 04 '20 at 20:21