I'm trying to automate CSV to XSLX conversion using the new TypeScript automation scripts in Microsoft Excel 365 on Windows.

My script looks like this:

function main(workbook: ExcelScript.Workbook) { let selectedSheet = workbook.getActiveWorksheet(); // Apply auto filter on first row selectedSheet.getAutoFilter().apply(selectedSheet.getRange("1:1")); // Apply auto width to all columns selectedSheet.getRange("A:O").getFormat().autofitColumns(); // Hide unimportant columns selectedSheet.getRange("E:G").setColumnHidden(true); selectedSheet.getRange("K:L").setColumnHidden(true); // Freeze 1 row and 4 columns selectedSheet.getFreezePanes().freezeAt(selectedSheet.getRange("D1")); // ... }

The problem is that this freezes the viewport such that the left-most accessible column is "D". The scrollbar is completely at the left stop but columns A-C are still beyond the appear. I can overscroll the scrollable area to see the columns are still there. I can also navigate into them by keyboard. But I cannot look at them.

I found this SO question for VBA with the exact same problem. But the mentioned solution to "Select A1 first" does not change anything, and I don't know how I could access anything like splitRow or splitColumn from the TS API.

LWChris's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.