Harsh Borad's avatar
Harsh Borad
Copper Contributor
Feb 05, 2025
Status:
New

Worksheet OnChanged event should return details when multiple cells are edited same as single cell

Description

I am using the Worksheet.OnChanged event in office.js to capture valueBefore and valueAfter for cell changes. When I change a single cell, the event provides the details object with changeType: "RangeEdited" along with valueBefore and valueAfter.

However, when I edit multiple cells at once (e.g., deleting/copy-pasting values into a range), the details object is undefined. This makes it impossible to track value changes for multiple-cell edits.

Below is a screenshot showing both scenarios.

Expected behavior

The details object should provide valueBefore and valueAfter for all modified cells, similar to how it works for a single cell.

Current behavior

For multiple-cell edits, details is undefined, making it impossible to track the changes.

Steps to reproduce

  • Register Worksheet.OnChanged event to capture valueBefore and valueAfter.
  • Modify a single cell → details contains valueBefore and valueAfter.
  • Modify multiple cells at once (e.g., delete a range of values) → details is undefined.

Useful logs

Here are screenshots when using the Worksheet.OnChanged event:

When "RangeEdited" in a single cell:

When "RangeEdited" in multiple cells or range:

 

Purpose of submission

This concern is raised because when using Excel's built-in Review → Show Changes, it correctly tracks before and after values for the same range "CD:C4".

 

Useful Links

Bug reported on office.js GitHub: https://github.com/OfficeDev/office-js/issues/5347

No CommentsBe the first to comment