Bugs on pivot table
Bug Report Excel Script lab.
Expected behavior: Print the information of each item in dataHierarchies.Class. Actual behavior:
Excel shuts down or restarts if adding more then 3 items into dataHierachies.(bug) It's ok if adding less than or eqaul to 3 items.(no bug)
Steps to Reproduce: grab worksheet. add pivot table add row into pivot table add dataHierachies into pivot table. run the program
Failure Logs: Excel restarts or shuts down.
Screenshot:

It is my sample code. You can try this.
async function run() { await Excel.run(async (context) => { const sheet = context.workbook.worksheets.getItem("Table"); const table = sheet.tables.getItem("Table"); const pivots = sheet.pivotTables; const pivot = pivots.add("Temp", table, "Table!J1");
pivot.rowHierarchies.add(pivot.hierarchies.getItem("Name")); pivot.rowHierarchies.add(pivot.hierarchies.getItem("Position"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("Age"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("Time"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("Salary"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("Gain"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("Tax"));
pivot.dataHierarchies.add(pivot.hierarchies.getItem("length of career"));
pivot.dataHierarchies.load("items");
await context.sync().then(async function () { console.log(pivot.dataHierarchies.items[0]) }) }); }