Posted 3 April 2025, 4:32 am EST
Hi,
The data changes in the SpreadJS can be captured using the command editCell. Please refer to the code snippet below that illustrates how to capture the data changes:
commandManager.addListener("appListener", (args) => {
if (args.command.cmd === "editCell") {
console.log("Data Changes");
}
});
Additionally, to capture the formatting changes, you can listen to the following commands-
Designer.setFormatter
Designer.setFormatDialog
Please refer to the code snippet below, which listens to these commands:
commandManager.addListener("appListener", (args) => {
switch (args.command.cmd) {
case "Designer.setFormatter":
case "Designer.setFormatDialog":
console.log("Formatting changes");
}
}
});
In case you need to listen to all the style changes, it is possible by checking if the changes in the sheet are style-changes as follows:
commandManager.addListener("appListener", (args) => {
const sheetName = args.command.sheetName;
if (
args.command[`changes${sheetName}`] &&
args.command[`changes${sheetName}`][0][0] === "style-changes"
) {
console.log("Style changes");
}
});
You can further refer to the attached sample that uses the above code snippets and listens to all the data, formatting, and style changes (see below).
Please feel free to reach out if you require any additional guidance.
Regards,
Ankit
ListenChanges (1).zip