How to revert my last action comprising few tasks in Google Sheet? - google-apps-script

Is there any way to revert (undo) my last action which comprises sorting, removing duplicates and protecting data. Currently I am doing all these three tasks together by pressing a submenu in Google Sheets.

View or revert to earlier versions
Note: You need Owner or Editor access to see the version history.
In Drive, open your file.
Click File and then Version history and then See version history.
Click a timestamp to see a previous version of the file.
Below the timestamp, you’ll see:
Names of people who edited the document
A color next to each person’s name. The edits they made appear in
that color
To revert to this version, click Restore this version.
Reference: Link

Related

Restore deleted script blocks

please help, I accidentally removed a huge portion of my codes in Google Script and accidentally saved it. Is there any way I can "Undo" and I get my previous version back?
Try this:
In the script editor, click Use legacy editor.
In the left-hand pane, click the name of the script file you want to restore.
Choose File > See version history.
Select the version you want to restore.
Click Restore.
Alternatively, use the revision history list to copy the code of the version you want to keep and paste it elsewhere.
To return to the new Monaco editor, click Use new editor.

Accessing & Reverting to Specific (preferablyNamed) Revision via Appscript in Google Sheets

I'm not finding a way to interact with 'Named' versions of a Google Sheet using the Drive Rest Revisions methods. Or to move a specific revision to the head.
I'm trying to sort out how to move a named revision to the head after an editor makes edits and finishes. Upon a finish trigger, I want the script to (among other things) reset the sheet to the specific named revision for the next user. (ideally) or, assuming there's no support for named version, to move the specific Revision to the head by RevisionID.
I've only played around with the 'Try it' feature on Google's Reference page for the various Revisions methods and have not found a way there to move a revision to the head or interact in any way with revisions by Version Name.

How do I unlock "padlocked" Apps script files in Google Apps Script?

I have a script project in which some "padlocked" .gs files are shown. I can't edit or delete them.
I need to use those files, but the person who locked them is unavailable.
I was trying to unlock the files using methods from the class LockService but it doesn't seem to work that way.
How do I "unlock" these files so I can edit them?
I figuered it. The padlock doesn't point to actual files withing this script. There is a library in a standalone script containing these files. When I use debugger it reaches these files from a standalone library and they are shown within the script with a padlock. So padlock simply means that those modules are from a separate script file! So it's not a lock.
I handled it by creating same modules withing the script and simply renamed few functions. So I am able to use debug for all my route.
Unfortunately, only the owner of the file or an admin of your domain (if you're using G Suite) can do that.
I had the padlock appear on two projects I own, and am the only editor of, without understanding why they first appeared. They appeared on my work laptop but not my home laptop. At work I'd been signed into one browser window with both my work and personal accounts. When opening the google sheet that contains the script it opens signed in as my work account. However, when opening the script from the sheet, the script opened but signed in as my personal account (that also has access). I guess this shouldn't really happen but it did. The solution was simple though, I just had to use the drop down to select my work account, which opened a new window for the script without a padlock and I was able to edit as normal. Was quite confused for a while... phew!
I had the same problem. As it turned out none of the above fixed it although similar but different to the other person who fixed his. In my case i have multiple chrome users on a single machine. I log in at the browser level.  I was in the browser for user A who also owned the file. When I opened up the bound google script project attached to the gooogle sheets file, it opened up as it should but locks were on each tab. I was confused for about 10 minutes.
In the upper right corner of the interface, there was a drop down that was showing User B email address even though above that, at the browser level I was clearly in the browser of user A. I clicked that drop down and changed to User A and the locks disappeared.  It seems they have an odd way of managing users on these gsp's that subverts the browser level user login. 

Delete a google-apps script

I've created a spreadsheet, and over the years I've been editing/adding scripts to this spreadsheet to extend functionality. While doing this, I inadvertently created some extra projects. Now when I click Tools -> Script Editor, it comes up with the following:
How do I delete "Copy of Character Data", and "Untitled project"? I'd like to keep the google spreadsheet around (As I'd like to keep its revision history).
I've tried following this post, but to no avail. Going to "script.google.com" simply loaded my last script, and didn't give me some type of dashboard where I could remove individual scripts. I see no delete option anywhere, and there is no scripts that I could find in "drive.google.com".
Choose the project you want to delete and when you are in you have the option to delete it (as long as you are the owner of the project).
If you don't see the option Delete project, that means those projects weren't created with the account you're logged in. Log in with that account or ask the person who created them to delete those projects.

How can I remove a project from a Google Spreadsheet?

I made a copy of a Google Apps Script project by mistake by choosing File > Make a copy... on Script Editor and since then every time I click Tools > Script Editor... on the Spreadsheet screen the project belongs to, I see a screen showing the two projects (original one and copied one) and I need to choose one to open the script editor. To be worse, the original script became unexecutable since I made the copy, I don't know if this is the cause of that though.
So, I'd like to remove the copy project from the Spreadsheet. How can I do that? I can't find any menu to remove project.
Thanks,
Open the "copy of" version of the script, click File -> Delete Project... This will generate a confirmation box. Click the Delete button to confirm that you would like to delete the project. This should leave your original as the only associated script.