feat(googleSheets): auto-collapse pivot table outer row groups on export - #3
Open
andrewleverette wants to merge 1 commit into
Open
feat(googleSheets): auto-collapse pivot table outer row groups on export#3andrewleverette wants to merge 1 commit into
andrewleverette wants to merge 1 commit into
Conversation
Collapse every pivot table's outer-most row-field group before exporting a Google Sheets template report as xlsx, so the rendered file shows only header/Total rows instead of every expanded detail row. - Read each pivot table's rendered cell text to discover current group values (freshly written pivots have no pre-existing ValueMetadata). - Merge Collapsed = true into the outer-most PivotGroup's ValueMetadata per discovered value, preserving entries for values not currently rendered, and write the whole PivotTable back via UpdateCells. - Batch collapse requests (chunks of 100) via batchUpdate. - Wire into GoogleSheetsTemplateReportControl as a best-effort step: a collapse failure is logged but doesn't block export. Mirrors the pivot-collapsing algorithm and Sheets API call shapes used in the node-utility project's googleSheetsClient. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Collapses every pivot table's outer-most row-field group before exporting a Google Sheets template report as xlsx, so the rendered file shows only header/Total rows instead of every expanded detail row.
Changes
GoogleSheetsClient.CollapsePivotTables(spreadsheetId): reads each pivot table's rendered cell text to discover current group values (freshly written pivots have no pre-existingValueMetadata), mergesCollapsed = trueinto the outer-mostPivotGroup'sValueMetadataper discovered value (preserving entries for values not currently rendered), and writes the wholePivotTableback viaUpdateCells. Requests are batched in chunks of 100 viabatchUpdate.GoogleSheetsTemplateReportControl: callsCollapsePivotTablesas a best-effort step before export — a failure is logged but doesn't block the report from being generated.GoogleSheetsClientException: adds theCollapseerror type.Notes
This mirrors the pivot-collapsing algorithm and Google Sheets API call shapes used in the
node-utilityproject'sgoogleSheetsClient(same constants, same detection/merge logic, sameupdateCells/batchUpdaterequest shapes), verified by direct comparison.