Collapse pivot table fields via excel JS api

Anonymous
2021-07-16T19:33:26.14+00:00

I have an addin using the excel JS api that generates a pivot table. I wish to collapse the fields of this pivot table. This seems to be possible in the VBA api via pf.ShowDetail and DrillTo, but these functions/fields do not seem to be present in the JS api. Is there any workaround or similar method I can use?

If not, is there a place where I can request that this feature be added to the JS API?

Microsoft 365 and Office Development Office JavaScript API
Microsoft 365 and Office Development Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-07-20T15:35:04.813+00:00

    We found that you can collapse individual items in the pivot table by digging all the way down to the PivotItem and setting the isExpanded field (see docs here).

    This is a pain though because we really want to just have every item collapsed for every row field (everything is expanded by default), so to accomplish this we have to manually dig through every field and every item to collapse them. We'd really like to have something equivalent to the "collapse entire field" functionality you get in the UI.

    Is there a place where we can request this feature?

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.