Roberto Russo
Roberto Russo

Reputation: 853

Google Script: autoResizeColumn not working properly on hyperlink

recently I've been working on Google spreadsheet using the incorporated script editor. I've a bunch of columns with some data retrieved automatically from a web request.

One of this column has all hyperlink of different lengths plus a simple header. When I try to perform the method

ss.autoResizeColumn(2);

the execution of autoResizeColumn seems to use as reference the header value.

When executing the automatic resize manually to other columns without hyperlinks all works just fine. Doing this operation directly using the sheet, the hyperlinks column is being resized correctly .

The header is insert with this command:

ss.getRange(3,2).setValue("header").setFontSize(20).setFontWeight("bold");

and the hyperlinks with this command:

ss.getRange(row,column).setFormula('=HYPERLINK("url";"text")');

Any help is really appreciated.

Upvotes: 4

Views: 2058

Answers (1)

Max Makhrov
Max Makhrov

Reputation: 18727

I guess, you need to run flush before resizing columns:

  SpreadsheetApp.flush();
  ss.autoResizeColumn(2);

Upvotes: 2

Related Questions