OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

"Invalid sheet" error when sheet name is changed on Office on the web - Excel #3218

Open NosQlik opened 1 year ago

NosQlik commented 1 year ago

Provide required information needed to triage your issue

I've started a new Office Add Ins project, with Excel and Typescript. Adding the setting sheet name code (https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-worksheets#rename-a-worksheet), I can reproduce this issue using Office on the web - Excel: image

I cannot reproduce this issue using the Excel installed on the local machine.

Your Environment

Expected behavior

I expect to not see the dialog error if I change the worksheet name with office add ins.

Current behavior

Error: Invalid Sheet. The worksheet that you requested does not exist in the workbook.

Steps to reproduce

  1. Build your first addins following these commands: https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-quickstart-jquery?tabs=yeomangenerator
  2. Choose Typescript and Excel during the creation
  3. Change the run() function in taskpane.ts with the following:

    export async function run() {
    try {
    await Excel.run(async (context) => {
      let currentSheet = context.workbook.worksheets.getActiveWorksheet();
      currentSheet.name = "New Name";
    
      await context.sync();
    });
    } catch (error) {
    console.error(error);
    }
    }
  4. Run the project and open the manifest using Office on the web
  5. Click on the "Run" button present in addins
ghost commented 1 year ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

gingerjia commented 1 year ago

@NosQlik thanks very much for reporting the issue! I can repro the issue locally and open a bug (7705861) for it. We will update here when the issue is fixed. Thanks!