William Garske
William Garske

Reputation: 317

Google Script - Running on Google Docs

I am wanting to deploy a Google Script project from a Google Document where the text from the Google Doc is displayed to a particular region of an index.html file. Is there any way to do so? I would be very curious to learn.

<html>
<h1> Header </h1>
[Google Document Code Goes Here.]
</html>

Upvotes: 0

Views: 81

Answers (1)

Cooper
Cooper

Reputation: 64100

This is a simple dialog that displays the text from a google document to a textarea tag in an html dialog.

function displaytestintextarea() {
  const doc = DocumentApp.getActiveDocument();
  const body = doc.getBody();
  const text = body.getText();
  DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(`<textarea row="25" cols="50">${text}</textarea>`),"Text in TextArea");
}

In this situation it's not required to provide the entire html.

enter image description here

You can resize it to anysize you wish.

Upvotes: 2

Related Questions