The signature that trips everyone up
autoResizeColumns(startColumn, numColumns) takes a 1-based starting column and a count of how many columns to resize — not a start and end. If you want columns B through E (columns 2 through 5), the call is sheet.autoResizeColumns(2, 4). Writing autoResizeColumns(2, 5) resizes B through F, one column too many. I hit this the first time I wired a post-import trigger and spent ten minutes wondering why column F kept collapsing.
To resize everything, grab sheet.getLastColumn() for the count and always start at 1. If the sheet is empty, getLastColumn() returns 0, so guard against that before calling autoResize or you get a clean no-op instead of a runtime error.