My code below imports to a Gdocument a table (rows and col) selected in Gsheet but my problem is that the columns width are not kept when the tab is copied in the Gdocument so I spend hours to set again the columns width in the Gdocument.
Do you have any suggestion to help my tab to keep its columns width?
Here is my code :
function readFromSpreadsheetAndWriteOnDoc()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sourcesheet = ss.getSheetByName('Feuille 1');
var selection = ss.getActiveRange().getA1Notation();
var srcData = sourcesheet.getRange(selection).getValues();
var doc = DocumentApp.openById('1a2X5oZhW2aY-p15vMvvPt9wvhm1UVHJU5_3ZJ3-OCBo'
var body = doc.getBody();
body.insertParagraph(3, 'My Title').setHeading(DocumentApp.ParagraphHeading.HEADING1).
setAlignment(DocumentApp.HorizontalAlignment.CENTER);
table = body.appendTable(srcData);
table.getRow(0).editAsText().setBold(true);
}