andrewriess's avatar
andrewriess
Copper Contributor
Dec 11, 2024
Status:
New

Support Undo via Excel JavaScript API

When doing any kind of workbook manipulation from a taskpane using the javascript API, it clears the undo stack associated with the workbook.

It appears that this is by design from what I read. I think workbook manipulation from taskpane is a very common use case. Mine in particular is a formula builder inside the task pane that has an insert button once the formula is complete. Arguments for the formulas make API calls to my external application that will be used as inputs for the excel formula which is why we have this helper. If the user clicks insert, the undo stack is cleared. The insert code is simple:

Excel.run(async (context) => {
const range = context.workbook.getActiveCell();
range.values = [[text]];
range.format.autofitColumns();
return context.sync();
});

Can Excel JavaScript API operations be made compatible with undo functionality in excel?

  • bbirk's avatar
    bbirk
    Copper Contributor

    +1.  This is urgent to our company's usecase... I can't understand how this isn't a feature of the API yet.