Many times, when sharing code across a file (google doc, word doc) rather than a text editor, it will be helpful to use a syntax highlighter so that the code is more readable (to the eye at least). Here are the tools that I recommend:
ide.thecodingwizard.me - paste your code here, copy it, and paste it into the google doc. The only downside is that there is only one style, but I think it looks fine
PineTools Syntax Highlighter - choose the style that you want in the drop down menu first. Paste your code, press highlight, and then copy the output into your google doc