Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

google apps script - Backing up Gapps source

I have fallen into the trap of (accidentally) deleting all scripts from the script editor. Lost 3 weeks of work in this lesson. I (maybe) will not do that again, but it raises the question "What is a complete backup solution for Gapps source?"

I, of course, can make a copy of my script either in the editor, or within Google drive. I however question if my (very complex) User interface (built using GUIBilder) is protected. So far, I have been unable to locate the code GUI Builder throws.

Also note it is not possible to download an apps script in GDrive, so how do I get a personal copy of my work product?

===== To clarify - I know how to copy and paste the source of a script BUT this does not capture the 200 gadget GUI that was built using GUI Builder.

As to the trap door in the editor -- I had several versions of this development -- I highlighted ONE in the left hand list and requested delete (from withing the Google script editor) file/delete -- magic -- ALL SCRIPTS DISAPPEARED. I will never touch the File/Delete menu again.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In some cases, you should be able to get your code back. (EDIT - except, it seems, any script file you delete from within the script editor, and any auto-generated code related to the GUI Builder, or Forms. -- Ouch!)

Your options depend on what you mean by deleting all scripts from the script editor.

  1. If you only deleted the text of your script while in the editor, say by Ctrl-A + del, then you can recover it within the editor. File - See Revision History will bring up a dialog that lets you time-travel back to when your script was intact.

  2. If you deleted the file from Google Drive, then it's in a trash folder, and can be recovered from there. You'll find the Trash folder in the Drive navigation tree.

    Expand More folders Trash Folder

  3. If you deleted a script "file" from within the editor, you're out of luck until Google fixes Issue 1424: There is no possibility to recover script files/projects.

  4. If you deleted any auto-generated code related to the GUI Builder, or Forms, you can't get them back. (Forms are not included in Restore from Revision History)

If you want to store your scripts some other place, that's a good idea - that will provide additional safety for items 1 to 3, but unfortunately not 4. You will need to copy the text from the editor into another file or online repository (e.g. Github). Get into the habit of including info about Libraries in your comments, because there is no way to back up those resource links.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...