Looking for event table creation

Posted by: trankhanhngan00 on 3 June 2025, 10:50 pm EST

    • Post Options:
    • Link

    Posted 3 June 2025, 10:50 pm EST

    Hi team,

    I wanted to ask if there’s any way to detect specific actions such as pivot table creation, new table creation, or changes to conditional formatting? I’ve checked the list of events available in Sheets, but so far I’ve only found events related to table changes—not the creation itself.

    Thank you!

  • Posted 4 June 2025, 7:55 am EST - Updated 4 June 2025, 8:00 am EST

    Hi,

    From what I understand, you want to detect when a Pivot Table, a normal table, or conditional formatting is added.

    You can use the PivotTableAdded event, which triggers when a Pivot Table is created. Here’s a sample snippet:

    spread.bind(GC.Spread.Sheets.Events.PivotTableAdded, (e, info) => {
        console.log("Pivot table added:", info);
    });

    Although PivotTableAdded is an internal API, it can still be used for this purpose.

    Alternatively, you can use the addListener API, which triggers for any operation. While this is also an internal API, it allows you to track specific designer commands. For example:

    • “Designer.createDefaultPivotTable” – when a Pivot Table is created

    • “Designer.createDefaultTable” – when a normal table is created

    • “Designer.applyRule” – when conditional formatting is applied

    Here’s a sample implementation:

    spread.commandManager().addListener("app", (args) => {
        console.log("Command executed:", args);
        if (args.command.cmd === "Designer.createDefaultPivotTable") {
            console.log("Pivot Table created:", args);
        } else if (args.command.cmd === "Designer.createDefaultTable") {
            console.log("Table created:", args);
        } else if (args.command.cmd === "Designer.applyRule") {
            console.log("Conditional formatting applied:", args);
        }
    });

    Refer to the attached GIF:

    Regards,

    Priyam

  • Posted 5 June 2025, 12:16 am EST

    Yes, thank you Priyam! You helped me solve this issue — really appreciate it!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels