0
votes

So I created a Google Document report by pulling values from Spreadsheet and writing them in table form. However, the text defaults to normal and I want to change the line spacing.

I've tried going from the front end and putting the insertParagraph within the cell text. I tried from the back end and editing the text that's already there. I've tried just creating a document element and doing each cell manually, but nothing works! I'm at my wits end! Help!

var a1 = sheet.getRange(1,1).getValue();
var b1 = sheet.getRange(1,2).getValue();
var a2 = sheet.getRange(2,1).getValue();
var b2 = sheet.getRange(2,2).getValue();
var a3 = sheet.getRange(3,1).getValue();
var b3 = sheet.getRange(3,2).getValue();
var a4 = sheet.getRange(4,1).getValue();
var b4 = sheet.getRange(4,2).getValue();

var RequestorInfoCells = [
 [a1, a2],
 [a2, b2],
 [a3, b3],
 [a4, b4]
 ];

var TableReqInfo = file.insertTable(0, RequestorInfoCells);
1

1 Answers

0
votes

I don't see anything you can do about line spacing in scripts, but just use setFontFamily(). You can chain it after insert table.

var TableReqInfo = file.insertTable(0, RequestorInfoCells).editAsText().setFontFamily(DocumentApp.FontFamily.CALIBRI);