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

Arnav Garg 0 Reputation points
2024-06-24T20:43:20.21+00:00

Trying to add comments programatically to Excel through my add in, but getting "this operation is not implemented" error every time.

Code for reference (in taskpane.js):

function comment(text) {
  Excel.run(async context => {
    const range = context.workbook.getSelectedRange();
    range.values = [[text]];
    

    let comments = context.workbook.comments;

    // Note that an InvalidArgument error will be thrown if multiple cells passed to `Comment.add`.
    comments.add(range, "TODO: add data.");

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

Alternatively, are there any other ways to add metadata about a cell to store info? The only reason I'm trying to make a comment is so that I can store information about the cell and later access it in my taskpane, but is there a form of metadata or something I can programatically access through my taskpane instead of a comment?

Also worth noting I just followed the code suggested in Excel API docs: https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-comments

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,639 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,671 questions
0 comments No comments
{count} votes