Get the address of the cell that invoked my custom function officejs excel add-in

461 Views Asked by At

Is it possible to get the address of the cell that invoked my custom function from excel JS API?

When I use the invocation parameter in custom Function like this:

/**
 * Return the address of the cell that invoked the custom function. 
 * @customfunction
 * @param {number} first First parameter.
 * @param {number} second Second parameter.
 * @param {CustomFunctions.Invocation} invocation Invocation object. 
 * @requiresAddress 
 */
function getAddress(first, second, invocation) {
  var address = invocation.address;
  return address;
}  

I get the error: Since @requiresAddress is present, the last function parameter should be of type CustomFunctions.Invocation

OBS: I'm using the shared runtime.

Dev environment: Windows 10, office 365 MSO (16.0.13929.20222) 64 bits, Edge Version 90.0.818.51 Up to date, Vs Code with Yeoman generator, Excel desktop, Shared Runtime.

0

There are 0 best solutions below