I have an Excel sheet, which is filtered with slicers and contains a column with checkboxes. I would like to create a script which reverses the values of the visible checkboxes.
I'm new to TypeScript, but I've constructed the basic structure. Problem is; because the column contains a header, I need to check the cellValue for a checkbox, before I flip the value. Unfortunately, typeOf only returns "object" and checking with instanceOf didn't work either. What would be the best approach to identify cells only with checkboxes?
Thanks in advance
function main(workbook: ExcelScript.Workbook) { let selectedSheet = workbook.getActiveWorksheet(); // get all the visible cells in the 'complete' column let visibleCheckboxes = selectedSheet.getRange("F:F") .getUsedRange() .getSpecialCells(ExcelScript.SpecialCellType.visible) // iterate over the all the checkboxes and flip their value visibleCheckboxes.getAreas().forEach((range) => { // mulitple ranges as we're filtering range.getValues().forEach(cellValue => { console.log(typeof cellValue) // if cellValue is a checkbox // flip value }); }); }