Hide columns with macro fail me

OS version: macOS Sequoia 15.3.12
App version: Community version 9.2.0
Downloaded from: ONLYOFFICE website

Steps:

  1. Create new spreadsheet.
  2. View>Macros
  3. Add the code from this blog post
  4. Run the macro
  5. The macro only hide rows, not columns.

Additional information:
I have tested on both mac and on web with the same result.

Hello @Simon1

We are checking the situation, please await my feedback.

I have an update. I was informed that back in 2023 some of the used method used to work differently. Right now, the same macro with corrections looks like this:

(function()
{
    const sheet = Api.GetActiveSheet();
    const rowsToHide = [2];
    const columnsToHide = ["B"];
    const hidden = sheet.GetRows(rowsToHide[0]).GetHidden();
    hideUnhideDetails(hidden);
    // Unhide if hidden, Hide if unhidden
    function hideUnhideDetails(hidden) {
        rowsToHide.forEach(row => {
            sheet.GetRows(row).SetHidden(!hidden);
        });
        columnsToHide.forEach(column => {
            sheet.GetCols(column).SetHidden(!hidden);
        })
    };
})();

Now you should specify the columns that you want to hide as a string, i.e. "B". If you want to hide/unhide multiple columns, then provide several values as an array like: ["B", "D"].