ドキュメントに hello を入力しておいて
hi と hey を追加する
コード.gs
function addText() {
var url = "https://docs.google.com/document/d/ID/edit";
var doc = DocumentApp.openByUrl(url);
var body = doc.getBody();
body.appendParagraph("hi" + "\n" + "hey");
}
|
getBody()しなくても動いた。
DocumentApp.openByUrl(url).appendParagraph("hi" + "\n" + "hey")
参考
appendParagraph(text)
https://developers.google.com/apps-script/reference/document/body#appendParagraph(String)