Question with no context:
Is there Google Apps Spreadsheet script property for looking at a Spreadsheet file and detecting whether or not that file contains scripts?
Question with context:
I’m wanting to programmatically copy a spreadsheet in Google Apps. the spreadsheet has several script function in one script file. I’ve tried setting it up as a template and that just resulted in errors (actually it wasn’t me in this part so I’m not 100% clear here. The error was something on Google’s end. The error message would appear at the top of the spreadsheet file when opened and none of the scripts would be linked.)
The issue I’m trying to resolve is whenever I copy the file, as a regular spreadsheet and not a template, it brings up a new tab that says “Loading…” and either finishes and closes that tab or just hangs and never closes the tab. If it actually finishes then the resulting copied file is the same as the source file. However, if the “Loading” tab never closes then the file will seemingly be copied but none of the scripts will have been copied over.
What I’d like to do is make a script that copies my files. If the resulting spreadsheet has scripts in it then stop but if there are no scripts present then delete that file and try again.
What I cannot find is a way to look at the contents of a Spreadsheet file and discover if there are scrips associated with it. Surely this property exists.
There is no such method to check wether a script is attached to a spreadsheet or not.
I’m a bit surprised by the trouble you are experiencing with copies… I’ve never had such issues …
If you want to be sure of your copy in a programitical approach, I guess the best solution would be to place your copy command in a try/catch structure : if no error occurs in the copy process then you can be sure the copy is a perfect clone of the original file. Use the
Docslistservice,file.makeCopy(doc here)