Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2019年1月19日土曜日

Googleドキュメントにテキストを追加したい


ドキュメントに 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)

Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues https://issuetracker.google.com/savedsearches/566234 Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...