Excel Add In Can't Add Comments - This operation is not implemented.

Arnav Garg 0 Reputation points
2024-06-24T20:40:03.5366667+00:00

I'm currently on MacOS Sonoma (14.5) using Office16.86 (appears to be as updated as possible) building an Excel add in. I am trying to programatically add a comment to Excel on a specific cell through taskpane.js.

However, every time I try to add this comment, I get "This operation is not implemented." I am using the below code:

  Excel.run(async context => {
    const range = context.workbook.getSelectedRange();
    
    let comments = context.workbook.comments;
    comments.add(range, "TODO: add data.");

    await context.sync();
    logMessage('Comment inserted into Excel');
  }).catch(error => {
    logMessage(`Error inserting comment into Excel: ${error.message}`);
  });
}



Does anyone have any suggestions on how to do it?

Alternatively, my whole use case is I just want to store meta information about the cell and the best way I could think of doing it was through a comment, but do cells have metadata (or something similar) that I can access programatically to store/retrieve the meta information?

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yue Li 0 Reputation points Microsoft Employee
    2024-07-02T07:54:29.4+00:00

    Hi Arnav, I'm running your code on my machine and it's working fine. My MacOS Sonoma version is same with you, but using Office16.87. Maybe you can update your Office version and try it again. Thanks! :)

    However, it is important to note that a Range parameter can only be a single cell. Here is the document link: https://learn.microsoft.com/en-us/javascript/api/excel/excel.commentcollection?view=excel-js-preview#excel-excel-commentcollection-add-member(2) Hope it helps you!

    User's imageUser's image

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.