Share via

office scripts simple recording not working

Anonymous
2023-08-29T11:02:45+00:00

Hi, i try to record office script to filter out or hide rows based on the cell value.

i have column "T" containing formula resulting in 0 or 1, id like to run this daily and hide everything containing 0, and leave everything with 1 visible.

If i record script and play with the filter, i get as below:

function main(workbook: ExcelScript.Workbook) {

let selectedSheet = workbook.getActiveWorksheet();// Clear auto filter on selectedSheetselectedSheet.getAutoFilter().clearCriteria();// Apply values filter on column T (index 20)selectedSheet.getAutoFilter().apply(20, {filterOn: ExcelScript.FilterOn.values,values: ["1"],criteria: [{operator: ExcelScript.Operator.greaterOrEqual,value: 100}]});}

it results in error:

Line 8: Cannot read properties of undefined (reading 'greaterOrEqual')

similar thing comes when i try to script hiding rows.
Can't really understand how it can result in errors if i record this script with built in tools?

Thanks in advance
Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-30T03:12:04+00:00

    The best place for office script issue is in Microsoft Power Automate Community

    Microsoft Power Automate Community - Power Platform Community

    Kindly note that office script is not supported in this community.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments