-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript 5.osts
More file actions
1 lines (1 loc) · 1.45 KB
/
Script 5.osts
File metadata and controls
1 lines (1 loc) · 1.45 KB
1
{"version":"0.3.0","body":"function main(workbook: ExcelScript.Workbook) {\n // Get the active worksheet\n const selectedSheet: ExcelScript.Worksheet = workbook.getActiveWorksheet();\n\n const protection = selectedSheet.getProtection();\n\n // Pause protection\n protection.pauseProtection(\"imsorrydave\");\n\n // Get the currently selected range\n const selectedCell: ExcelScript.Range = selectedSheet.getUsedRange();\n const selectedAddress: string = selectedCell.getAddress();\n\n \n\n const activeRange: ExcelScript.Range = selectedSheet.getUsedRange();\n const activeAddress: string = activeRange.getAddress();\n\n \n if (activeAddress !== selectedAddress) {\n return;\n }\n\n // If editing in the selected cell, remove any added AutoComplete values\n const value: string | number | boolean = selectedCell.getValue();\n if (typeof value === 'string' && value !== '') {\n // Clear the cell if any auto-suggestion value is detected\n selectedCell.setValue('');\n }\n\n protection.resumeProtection();\n}\n\n","description":"","noCodeMetadata":"","parameterInfo":"{\"version\":1,\"originalParameterOrder\":[],\"parameterSchema\":{\"type\":\"object\",\"default\":{},\"x-ms-visibility\":\"internal\"},\"returnSchema\":{\"type\":\"object\",\"properties\":{}},\"signature\":{\"comment\":\"\",\"parameters\":[{\"name\":\"workbook\",\"comment\":\"\"}]}}","apiInfo":"{\"variant\":\"synchronous\",\"variantVersion\":2}"}