2

I have a string that is faux-html. ie:

var myHtml = "<div style=\"background:color:#000\">This is text</div>";

(Obviously its much longer and more complex than that, but it's a string nonetheless).

In apps script I need to send that to an API as actual HTML. so I want to convert the string to an actual Html Object.

I can make an actual Html file in the sidebar and reference that with 'CreateHtmlOutputfromFile(file)', but would prefer to not have to actually make the blank html file.

Is there any way of making a floating html file? Something to the effect of:

var myHtml = "<div style=\"background:color:#000\">This is text</div>";
var htmlOutput = HtmlService.CreateHtmlOutput();
htmlOutput.innerHTML = myHtml;

1 Answer 1

5

Use createHtmlOutput(String) method:

var htmlOutput = HtmlService.createHtmlOutput(myHtml);
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.