javascriptgoogle-apps-scriptsave

What do I do if my Apps Script didn't save?


I was working on an AppScript with a personal account. I clearly remember saving it. However when I looked back the next day, all the progress I made was gone.

I deployed it once around 30 min in and that deployment's code is still there in the version history. After that, I just used test deployments to test all changes, and none of the changes were saved. I lost about 3 hours of javascript and would prefer to not have to rewrite it. Is there a way to get back the lost code? This happened around 3 days ago.

I was expecting for my code to save, but instead it didn't.


Solution

  • The script editor does not synchronize code between windows, so one explanation is that you had opened the same script project in two windows, worked in one, saved that one, then saved the other one (where there were not as many changes.) The second window could have been opened on another computer.

    You're saying that you deployed the script. Deploying requires that you save a version, so perhaps you can use Project history to recover the lost code. The button is third from top in Script editor and it looks like a clock 🕓 with a counter-clockwise arrow ⤺.

    For more advanced code management, use clasp.