Skip to content

Reset Functions

Additional → Reset sheets runs the repair operation that brings an audit spreadsheet back into the shape the add-on expects. It re-applies data-validation dropdowns, formulas, formatting, and column order on the Results, Scenarios, Review Report, and "Report: NA or Support - v3" tabs, hides the deprecated Settings tab, and reinstalls the onEdit trigger.

Reset is invoked from the menu (via resetSheetsUiV3 in Code.js) and automatically as part of spreadsheet version updates 3.0.8 and 3.0.10. Row-range resets are also run by the onEdit automation for just the edited rows.

Reset_functions.js

Function Description Facing
resetSheets(ssId) Orchestrator. Reads all needed tabs and computed data, then in order: resets the Review Report sheet, the Results sheet, the NA-or-Support sheet, and the Scenarios sheet; fills scenarios into the Review Report; hides the Settings sheet; and reinstalls triggers. Defaults to the current spreadsheet. User-facing (menu, and called from updates)
resetResultsSheet_(ssId, data, templateSheetData, computed) Resets the whole Results sheet: delegates per-row work to resetResultsSheetByRows_(null, null, ...), then unfreezes columns, reorders columns to match sheetsConfig.results.columns_in_order, and re-freezes the configured columns. Internal
resetScenariosSheet_(ssId, data) Rebuilds the Scenarios tab: reads the sheet including formatting, normalizes step formatting from row 3 down, and writes back only changed cells. Internal
resetReviewResultSheet_(ssId, data) Resets the Review Report sheet's formulas and validations, pointing the Testing Tools and Platform/Browser columns at their configuration source ranges. Internal
resetReportNaOrSupportSheet_(...) Resets the "Report: NA or Support - v3" tab: the Criteria column, the Supported checkbox column, and the Details column's scenario dropdown. Finishes by refreshing the remarks preview. Internal
resetReportNaOrSupportRemarksPreview_(data) Clears column D and writes a single =PREVIEW_REMARKS(A2:C) array formula into the first data cell. Internal
hideSettingsSheet(data) Hides the Settings tab if it still exists (deprecated in 3.0.10). Internal
addSuccessCriteriaLevelColumn(reportSheet) Appends a "Success Criteria Level" column to a sheet that lacks it and returns the new column index. Internal
getRangeFormulasOrDisplayValues_(range) Reads display values, then overlays cell formulas back on top so writes preserve formulas instead of freezing them into values. Internal
getThirdPartyProductUrlByDisplayName_ / getThirdPartyCompanyUrlByDisplayName_ Look up a third-party product's or company's URL from the Platform/Browser-by-scope data. Internal

resetResultsSheet.js

Contains the single largest reset routine: rebuilding rows of the Results tab.

Function Description Facing
resetResultsSheetByRows_(startRow, numRows, currentSheetData, templateSheetData, computed) Passing (null, null, ...) resets the entire sheet (also clearing conditional formatting and borders and re-applying zebra striping); passing a range resets just those rows. For each row it re-derives the Success Criteria and Success Criteria Level from the chosen Issue Title, refreshes the Tutorial hyperlink, and rewrites every dropdown (issue title, EE status, scenario, steps, browser, testing tool, issue owner, third-party company/product) so they reflect the current template and configuration. Reads values, validations, and formatting in one pass, mutates clones, and writes back through the batched diff-writer. Internal (full resets and onEdit row resets)

Nested helpers inside it: getIssueAndCriteriaFromTemplate (resolves an Issue Title to its template criteria) and resolveCriteriaAndDerivedState (writes the Success Criteria hyperlink and level, sets the Issue Title dropdown to that criteria's titles, sets or clears the Tutorial link, and restricts the EE Status dropdown to Advisory only for level AAA criteria).

Reset_functions_helper.js - the batched diff-writer

Rather than calling many slow Range.setX() methods, the reset functions read a range, mutate in-memory copies, and hand the original and modified arrays to this file. It diffs them cell by cell and emits a minimal set of Sheets API v4 updateCells requests, batched through Sheets.Spreadsheets.batchUpdate. This is what makes a whole-sheet reset feasible inside the Apps Script execution time limit.

Function Description
updateRangeOnlyChangedAndOptimized_(data, sheetId, startRow, startCol, numRows, numCols, changes) Compares each supported aspect (value, font size/family/weight, alignments, wrap strategy, data validation) against the original; only changed aspects become updateCells requests with the appropriate field masks. Values starting with = are written as formulas.
setObjValueByFieldPath_(obj, path, value) Sets a deeply nested property from a dotted path, creating intermediate objects.
array2dClone_(arr) Shallow-clones a 2D array to snapshot original range data before mutation.