1
votes

Although cell borders in a GoogleSpreadsheet can be set manually to 6 different styles (dotted, dashed, solid (1px width), solid (2px width), solid (3px width) and double), it seems the current version of the API is limited to the options DOTTED, DASHED and SOLID for BorderStyle. The latter has a 1px width.

Is there a way which allows me to set a border with 2px width, either by choosing one of the other 3 styles not in the BorderStyle enum, or by setting the border width by any workarounds?

2

2 Answers

1
votes

It appears that multiple border thickness options is a very new feature as of February 2017, so I don't think it has made its way into the Enum options of apps script.

Google Help Forum Post on add border style options

1
votes

This should work

function borders() {
  SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Line 1").getRange("E21:F26").setBorder(true, true, true, true, true, true, 'black', SpreadsheetApp.BorderStyle.SOLID_MEDIUM);
}

Of course the sheet and range are just what I used for testing, should work with any range/sheet.

Here's the documentation for the border styles and here is the documentation for .setBorder