2022年11月3日木曜日

Googleドキュメントのテキストの色を一括で変えたい


下記コード.gsの ID を変えて myFunction() を実行すると、ドキュメントのテキストの色を #d3d3d3 に変更できました。



コード.gs
function myFunction() {
  var url = "https://docs.google.com/document/d/ID/edit";
  var doc = DocumentApp.openByUrl(url);
  doc.editAsText().setForegroundColor('#d3d3d3');
}


参考

editAsText()

setForegroundColor(foregroundColor)