jones-ch
Jul 04, 2022Copper Contributor
Status:
New
Update PivotTable DataSource with the Office Excel JavaScript API
It was possible to change an existing pivot table's data source when developing an Excel COM https://stackoverflow.com/a/9764063/4664207 and when using https://answers.microsoft.com/en-us/msoffice/f...
AdrianWu
Microsoft
Jun 20, 2024Hi jones-ch , the Excel JS API does not currently support changing the data source, only the value of the data source. However, if the reason to change the data source comes from your data source getting new data appended (like the COM add-in example you've provided), there is an effective way to assign a "table" instead of a "range" as your data source. This way, the pivot table must point to a fixed table, but the table itself can be changed, such as appending new rows. Hope this workaround is helpful!!