I have noticed in your current code that there is a letter C
above the function InsertCode()
which causes the error:
ReferenceError: C is not defined
I have tried to delete it and run the code, and it works as expected. I have a hunch that you just placed it accidentally.
Kindly try to run the code without it and see if it is indeed the issue you were having.
In such cases that you encounter an error, please try to check the @ macros.gs:[line number]
above the error as it will dictate the lines where it does have an issue.