You can avoid such behaviour in many different ways.
You can use the Paste as text option
Instead of using the Visual editor switch to the Text editor.
A third alternative would be to use the Clear formatting option after pasting your text.
Found that the issue is TinyMCE. Here is a solution that prevents the spans from being added on paste: https://bionicteaching.com/clean-google-doc-cut-paste-into-wordpress-editor/
Add this to functions.php:
//fix cut paste drama from https://jonathannicol.com/blog/2015/02/19/clean-pasted-text-in-wordpress/
The workaround I use is codepad.org.
I paste the code, select the language and then the website outputs the code in a colour coded way along with the line numbers.
I paste the code:
Then Copy the formatted code (If you want the line numbers, then include them in your selection too):
Pasting it in Google Docs will add it as a table preserving all the ...
Press Ctrl+Shift+U. An underlined U will appear. Press 2, 0, 1, 4, then space-bar. An em dash should appear.
Long and annoying process, but less annoying than Insert>Special Characters, because you don't have to take your hands away from the keyboard. Now to remember it.
As of Feb 2019, you can now do this with the Google Docs REST API in addition to Google Apps Script as mentioned in the other answers.
Here's a blog post I wrote linking to the video, page in the docs, and a working (Python) sample app I created that does exactly what the OP requested, mail-merging data from Google Sheets into a form letter created via ...
You can use Clasp: clasp allows you to develop your Apps Script projects locally. That means you can check-in your code into source control, collaborate with other developers, and use your favorite tools to develop Apps.
This is the closest I have been able to get:
Upload your HTML file to google drive
Open the file by double-clicking and select "open with google docs"
This way docs will try as much as it can to render the data.
what I got:
(following OP's comment)
To convert Google Docs en masse in a folder:
Select all of them using Shift or/and CTRL (Cmd for Mac)
Right click and select Download.
The Drive automatically converts all the selected documents and packs them into a ZIP file.
Save the created zip file. When un-zipped all files are converted.
There is no built-in way to do that but you could use Google Apps Script of the Google Documents API to build a script/add-on/program that do that.