0

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>
6
  • Do you want to maintain all of the formatting? Commented Jun 6, 2021 at 17:56
  • Yes, all of it. It doesn't have to be spaced out the same way though. Commented Jun 6, 2021 at 17:57
  • That will be a fair amount of work even if you know what you're doing. You might want to look for some addons that already exist. I don't know of any because I never use them. Commented Jun 6, 2021 at 17:58
  • Even just part of it would be helpful. I understand. Commented Jun 6, 2021 at 18:00
  • It's pretty simple if you don't want the format. You can get the body text and put it into a textarea. Commented Jun 6, 2021 at 18:02

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.