Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel Web Only Issue: Existing bindings are not working in Excel Web when tried to reload and add a listener to them #5141

Open
2 tasks
SenMS-CSA opened this issue Nov 27, 2024 · 2 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback

Comments

@SenMS-CSA
Copy link

SenMS-CSA commented Nov 27, 2024

Added few cell change bindings with onDataChanged event, the binding will exist forever and whenever user starts the add-in again the bindings will be reloaded using bindings.load("items") and added the event listeners to them, this perfectly working in Excel Desktop but not working in Excel Web

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Office on the Web
  • Host [Excel, Word, PowerPoint, etc.]: Excel
  • Office version number: 16.0.18325.42310
  • Operating System: Windows 11
  • Browser (if using Office on the web): Edge

Expected behavior

The bindings should work with event listener added back to them. If the user tries to change the cell value, the onDataChanged event added back should trigger

Current behavior

The event is not triggering and throwing an error
image

The events should trigger and execute

Steps to reproduce

1.Create a binding with onDataChanged event listener
2. Close the workbook and open again
3. run the code, execute a reload method for all existing bindings and add onDataChanged listeners using a button click

Link to live example(s)

https://github.com/SenMS-CSA/ExcelWebBindingsIssue/blob/main/Codesnippet

Provide additional details

Added the error screen shot

Context

The issue affects because the bindings have to be deleted and recreated every time rather than reusing it

Useful logs

  • Console errors
    image
  • Test file (Excel for Office on the Web

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Area: Excel Issue related to Excel add-ins label Nov 27, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Nov 27, 2024
@guoms1
Copy link

guoms1 commented Nov 28, 2024

Hello, SenMS-CSA

I’ve provided updated function below with some minor adjustments to enhance functionality and address a few issues. Please try replacing your existing functions with these to see if they help resolve the problem.

I’ve tested the updated code in an Excel Online add-in and it worked as expected without encountering the issue you described. If you have any further questions or need additional assistance, I’d be happy to help!

async function reload() {
    await Excel.run(async (context) => {
        const bindings = context.workbook.bindings;
        bindings.load("items");
        const getbinding = bindings
            .getItem('SalesByQuarter');
        getbinding.load("id");
        getbinding.onDataChanged.add(onSalesDataChanged);
        await context.sync();
        console.log("The bindings reloaded");
    });
}

Best regards,

@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Nov 28, 2024
@SenMS-CSA
Copy link
Author

Hello, SenMS-CSA

I’ve provided updated function below with some minor adjustments to enhance functionality and address a few issues. Please try replacing your existing functions with these to see if they help resolve the problem.

I’ve tested the updated code in an Excel Online add-in and it worked as expected without encountering the issue you described. If you have any further questions or need additional assistance, I’d be happy to help!

async function reload() {
    await Excel.run(async (context) => {
        const bindings = context.workbook.bindings;
        bindings.load("items");
        const getbinding = bindings
            .getItem('SalesByQuarter');
        getbinding.load("id");
        getbinding.onDataChanged.add(onSalesDataChanged);
        await context.sync();
        console.log("The bindings reloaded");
    });
}

Best regards,

Hello, SenMS-CSA

I’ve provided updated function below with some minor adjustments to enhance functionality and address a few issues. Please try replacing your existing functions with these to see if they help resolve the problem.

I’ve tested the updated code in an Excel Online add-in and it worked as expected without encountering the issue you described. If you have any further questions or need additional assistance, I’d be happy to help!

async function reload() {
    await Excel.run(async (context) => {
        const bindings = context.workbook.bindings;
        bindings.load("items");
        const getbinding = bindings
            .getItem('SalesByQuarter');
        getbinding.load("id");
        getbinding.onDataChanged.add(onSalesDataChanged);
        await context.sync();
        console.log("The bindings reloaded");
    });
}

Best regards,

I am still getting the same error after replacing the reload function. I tested using script lab only and my file saved in one drive. If you need, I will share the file as well.

Regards,
Senthilnathan

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback
Projects
None yet
Development

No branches or pull requests

3 participants