This is taking up How to copy plain text HTML/formatting method into Google Docs.

Taken from How to copy the "tree" command output from Linux Terminal without losing the red/blue/white colours of the folder/file tree? on Super User Stack Exchange:

tree /var/log/apt -La 1 -H var/log/apt -T test_title -C -o test.html

With this, you get a tree with var/log/apt as the root that is shown at the top of the tree (and as the only folder, it is blue).

enter image description here

How to put that, as it is, into Google Docs, by means of the menu or add-ons?

This is a duplicate, my hope is that for this example, there might be rather a chance than for the markdown question of the first link above, since there is already a workaround with the help of Microsoft Word, full copy taken from How to Import HTML into Google Docs?:

To do this, open Microsoft Word and its HTML file. You should see the file rendered the way it would look inside a browser.

Save this document in Word format.

Then, go back to Google Drive and upload the file to your Google Drive account. Once uploaded, right-click and select Open with, then select Google Docs.

This will open the document in Google Docs format, which is as close to the HTML representation as possible.

I do not have Microsoft Word access on this machine. Anyway, if the workaround is to load it there and copy and paste it to Google Docs, that is at least one hint that in the far or near future, there might be other workarounds for Google Docs to show HTML without the code. Thus, I ask for further workarounds, menu tricks, Add-ons.

The other Google Sheets "importHTML()" function trick listed in the same guide How to Import HTML into Google Docs? does not work, since that is only for HTML "lists" and "tables", see IMPORTHTML, and if I copy and paste the HTML into a Google Doc to use its URL in the funcction =importHTML("https://docs.google.com/document/d/xzyxzyxzy","list",1), I only see:

enter image description here

and changing the index will reach the same or an N/A.

1 Answer 1


Workaround: Alacritty terminal

This does not copy colours or links. Open the file in Alacritty terminal and copy the HTML plain text from there. Paste it in Google Docs to see:

enter image description here

It has not copied the colours or links, but it has the size and style of the writing. At least, you do not need to make a screenshot anymore so that you can change each line as you like.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.