Get cell to the left of the button click (excel online scripts button)

New Contributor

Hi everyone


We can now add a button to execute an Excel Online Script - awesome.


I need my button to use the data within the cell to the left of it (not the 'active cell').


Getting the active cell is easy or the cell to the left of the active cell etc:


let activeCell = workbook.getActiveCell();
console.log(`The active cell's address is: ${activeCell.getAddress()}`);



But, people might have any old cell active then they click the buttons that I have on every row.


.... and if they are going to click ten buttons left say to copy the data from one cell to another (for example), the active cell would not be moving with them. 


I need to capture the location of the button I think....






0 Replies