Hi Arnav, I built an Excel Add-in locally and it's working well. Here is my taskpane.js code. You can copy it and try to it. Hope it helps you! Thanks! :)
export async function run() {
try {
await 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();
console.log('Text inserted into Excel');
});
} catch (error) {
console.error(`Error inserting text into Excel: ${error.message}`);
}
}