Excel Add In Can't Add Comments - This operation is not implemented.
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