There are no event listener when a new defined name is created inside excel.
workaround
Our current proposed workaround is similar to the conditional formatting workaround where we check Excel. NamedItemCollection.getCount every 5 seconds to check whether size is different. If it is different than this would mean that the user has created a new defined name (named range).
risk
poor performance, heaving client logic
Proposed Solution 1
Implement an onAdd event listener for Excel.NamedItemCollection to notify any new defined name being created. This would prevent our client having to periodically check for new define names.
This event listener should have at least the below data in the arguments:
the created defined name
a. worksheet name
b. cell range
Issue 2
There are currently also no way to detect when an existing defined name is being edited (in the case of renaming a defined name or modifying the cell range).
workaround
Client has to create an update button for the user to detect any new defined names.
Every 5 seconds call Excel.NamedItemCollection.items to get the whole list of defined names and compare with the previous list of defined names to see any has changed.
risk
Poor performance, heavy client logic
proposed Solution 2
Implement an onChange event listener for Excel.NamedItemCollection to notify any new defined name being modified.
This event listener should have at least the below data in the arguments:
the updated defined name
a. updated worksheet name
b. updated cell range
c. the previous change (cell range, name of the defined name, etc)
@achang0406 if you haven't already done so, can you please log this as a feature request in UserVoice? We'll be archiving this repository (OfficeDev/office-js-docs) soon.
Similar to issue https://github.com/OfficeDev/office-js-docs/issues/1503
Issue 1
There are no event listener when a new defined name is created inside excel.
workaround
Our current proposed workaround is similar to the conditional formatting workaround where we check
Excel. NamedItemCollection.getCount
every 5 seconds to check whether size is different. If it is different than this would mean that the user has created a new defined name (named range).risk poor performance, heaving client logic
Proposed Solution 1 Implement an
onAdd
event listener forExcel.NamedItemCollection
to notify any new defined name being created. This would prevent our client having to periodically check for new define names.This event listener should have at least the below data in the arguments:
Issue 2
There are currently also no way to detect when an existing defined name is being edited (in the case of renaming a defined name or modifying the cell range).
workaround
Excel.NamedItemCollection.items
to get the whole list of defined names and compare with the previous list of defined names to see any has changed.risk Poor performance, heavy client logic
proposed Solution 2 Implement an
onChange
event listener forExcel.NamedItemCollection
to notify any new defined name being modified.This event listener should have at least the below data in the arguments: