Forum Discussion
JKPieterse
Oct 25, 2022Silver Contributor
Getting the sourceString of all pivot tables in a workbook
I'm trying to run through all pivottables in an Excel workbook and list their sources, but I'm not succeeding. I'm using code like this:
async function SearchInPivots(
context, wb: Excel.Workbook) {
let foundPivots = new foundCollection();
let pts = wb.pivotTables.load("items");
let ptCt = pts.getCount();
await context.sync();
let ptColl = [];
let pt:Excel.PivotTable = null;
for (let i: number = 0; i < ptCt.value; i++) {
pt = pts[i].load("getDataSourceString");
ptColl.push(pt);
}
await context.sync();
for (let i: number = 0; i < ptColl.length; i++) {
console.log(ptColl[i].getDataSourceString());
}
return foundPivots;
}
What am I missing?
Cross-posted here: https://stackoverflow.com/questions/74178968/getting-the-sourcestring-of-all-pivot-tables-in-a-workbook
- The question has been answered here:
https://stackoverflow.com/questions/74178968/getting-the-sourcestring-of-all-pivot-tables-in-a-workbook/74198467#74198467
- JKPieterseSilver ContributorThe question has been answered here:
https://stackoverflow.com/questions/74178968/getting-the-sourcestring-of-all-pivot-tables-in-a-workbook/74198467#74198467