script to format worksheet

0

I'm trying to create a script that will format all the cells of a banner in bold, centered italic content. This is necessary because I have a Googleforms linked to a worksheet, and every time I send a response through the forms, it appears in the worksheet without formatting. So I intend to force this formatting via script. I have the following code that applies the italic and bold formatting in a range of cells, but it is not working. Also, I plan to apply centralized and vertically adjusted, and I do not know how. The script follows, and when I run it gives the message: "Invalid range height. The value given was 1, but it should be 99 (line 11, file" formataCelulas ")"

function myFunction() {
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var sheet = ss.getSheets()[0];

 // The size of the two-dimensional array must match the size of the range.
 var fontStyles = [
   ['italic', 'normal']
 ];

 var range = sheet.getRange("A2:K100");
 range.setFontStyles(fontStyles);

}
    
asked by anonymous 24.05.2018 / 15:34

0 answers