I want to copy all tables exactly like in google sheets,
I tried this script but the table is not the same, does anyone know if the table is exactly the same?
function table() {
var ss = Sheets.Spreadsheets.Values.get("assassa", String("Sheet1!A1:Z")).values;
var doc = DocumentApp.openById("asas"); // Or find one by name/ID
var body = doc.getBody();
var date = new Date();
var time = date.toLocaleString("id", {
"day": "2-digit",
"month": "long",
"year": "numeric",
"minute": "2-digit",
"timeZoneName": "short",
"minute": "2-digit",
"second": "2-digit",
"hour": "2-digit",
})
var dataYouWant = ss;// stores a 2D array with the values
body.clear();
body.insertParagraph(0, `Data update: ${time}`).setHeading(DocumentApp.ParagraphHeading.HEADING1);
table = body.appendTable(dataYouWant); // pastes table in doc
table.getRow(0).editAsText().setBold(true);
}
edit:
From the photo above, the google sheet row F1:G1 data is fused, while in google docs it is not
Link: Google Sheet: https://docs.google.com/spreadsheets/d/1aof6Nt9kadhkIGlNHGmU9sH-j8Q6fOQzgcedD3tjlkk/edit?usp=sharing
Google Docs: https://docs.google.com/document/d/18i8rsuwMkmIPnLUTmRsEBGhye7MQG2Ypn25OcCElZ1Q/edit?usp=sharing