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
686 stars 95 forks source link

Excel: slicers.add results error in all platforms - GeneralException: There was an internal error while processing the request. #5032

Open power-reconcile opened 1 week ago

power-reconcile commented 1 week ago

slicers.add results in GeneralException: There was an internal error while processing the request.

Your Environment

Expected behavior

Slicer can be added by office.js

Current behavior

Error message was show: GeneralException: There was an internal error while processing the request.

Steps to reproduce

Prerequiste: Given you have an Excel work book with a sheet and a table;

call addSlicer function that is similar to https://learn.microsoft.com/en-us/javascript/api/excel/excel.slicercollection?view=excel-js-preview#excel-excel-slicercollection-add-member(1) https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-slicer.yaml

For example: with a sample Excel file like this, the sheet name is Report, the table name is reportV2, the column to add slicer is Status.

Contoso_Statement_Test.xlsx

e.g.


    await Excel.run(async (context) => {
      const sheet = context.workbook.worksheets.getItem("Report");
      const slicer = sheet.slicers.add(
        "reportV2", /* The slicer data source. in our case, it is a table */
        "Status" /* The field in the data source to filter by.  */
      );
      slicer.name = "Status Slicer";
      await context.sync();
    });
  }```

This worked well with previous Excel versions, such as Excel Version 2404 on Windows.

## Link to live example(s)
<!--- Ideally, provide a link to a live example, created and shared using -->
<!--- [Script Lab](https://aka.ms/scriptlab). If relevant, create two buttons, -->
<!--- one that sets up data in the document, and another that exemplifies the issue. -->
1. ______
2. ______
3. ______

# Provide additional details
<!--- If the snippet requires extra explanation, provide repro steps: -->
1. ______
2. ______
3. ______

## Context
Now user cannot add slicer through office.js, in all of the latest Excel version across Windows, macOS and Office on the web.

## Useful logs
<!--- Please include any of the following logs that may help us debugging your issue -->
- [ ] Console errors
- [ ] Screenshots
- [ ] Test file (if only happens on a particular file)
![Screenshot 2024-11-02 at 14 31 28](https://github.com/user-attachments/assets/f5bbb490-c58c-4914-82b4-bbb298cb2c13)

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. 
RuizhiSunMS commented 1 week ago

Hi @power-reconcile, thx for your submit. I reproed the issue on web but didn't on win32 client. Create an item #9503854 into our backlog to track it. We will reply to you as soon as there is any progress. Thank you for your patience. Btw, let me confirm it again, the api returned the exception on all of win32, mac and web worked on your side?

power-reconcile commented 1 week ago

Hi @power-reconcile, thx for your submit. I reproed the issue on web but didn't on win32 client. Create an item #9503854 into our backlog to track it. We will reply to you as soon as there is any progress. Thank you for your patience. Btw, let me confirm it again, the api returned the exception on all of win32, mac and web worked on your side?

Hi RuizhiSun, thanks for your feedback! This issue can be reproduced on all of the platform: Windows, macOS and web.

The reason you can't reproduce on the win32 client is probably because you might not have updated the Excel version to 2410(https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date), which was released on Oct 28, 2024. Can you please kindly check your Excel version? Thanks!

RuizhiSunMS commented 1 week ago

ack. I will convey your words to my colleagues. Thx @power-reconcile