Undo the changes made by Office Scripts

You cannot undo changes made to the Excel workbook by a script with the Excel's Undo command. Instead, you must restore a previous version of the workbook from your cloud storage.

Version history

Office's version history is an easy way to restore an older workbook through the Excel UI. The feature only works for files stored in OneDrive or SharePoint Online.

From the Excel workbook in which the script was ran, use these steps to undo the effects:

  1. Go to File > Info > Version History.
  2. Select a version saved prior to the running the script.
  3. Select Restore.

See also