Edit column width

Here is a tip how to edit column width

 

Source code

function setColWidth() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getActiveSheet();

  // (a) Edit a column's width
  sh.setColumnWidth(3, 10);

  // (b) Edit columns' width
  sh.setColumnWidths(5, 2, 180);
}

 

Format

(a) SheetObject.setColumnWidth(columnPosition, width)

(b) SheetObject.setColumnWidths(startColumn, numColumns, width)

 

Parameters

(a) “setColumnWidth”

columnPosition … Target column number.

width … New width value you like

(b) “setColumnWidths”

startColumn … 1st column number to be edited.

numColumns … The number of columns to be edited.

width … New width value you like.

 

Responses

None

Leave a Comment