Google Sheets Script Editor View Only - google-apps-script

If you have the link to the Google Sheet Script Editor you can view it in read only mode if you have the link to get there but it seems you can't have access to that link unless you have edit permission... is there anyway to get to the view only Script Editor without having the link or copying the entire project?

No, there is no way to do that.
As explained in the official documentation, if you only have view access to the parent file, the only way to access the script is by making a copy of the parent file.
And a bound script cannot be shared without sharing the container file (they cannot be detached from the file they are bound to, as indicated here).

Related

Error when using SpreadsheetApp's addEditors function under a shared drive's spreadsheet

When I use the SpreadsheetApp.getActiveSpreadsheet().addEditors() on a spreadsheet inside a Shared Drive (this doens't occur if I move the spreadsheet to My Drive), it returns the following error for editor who are not already an editor:
You do not have permissions to access the requested document.
I'm able to add editors as usual using the interface dialog, so I don't think it's not a privilege problem regarding adding editors. Maybe this is some bug because I'm not a member of the Shared Drive (I'm only editor of the spreadsheet)?
Did anyone experienced this same problem? Can I get around it, without moving the file to My Drive, or adding myself as a member of the entire Shared Drive (there are other documents which I'm not supposed to access)? Should I file a bug report to Google?

Google App Script Make text within a document readonly?

I have a library that is adding data to a shared document. Is it possible to keep the document editable save for specific word patterns? For example every text between two * * can't be modified by users who aren't the owner?
I Google Document in no way to lock part of document. It is possible in SpreadSheets only (known as protected ranges).
Bus is here different way to get similar effect. You can share the Document as read-only (view only) and write Google Script Web App what provide custom editor interface to User. The script will have set Execute the app as permission to You. That mean, only You and your Script can edit the Document and in Script you can write write custom protection.

How to run a google script from a google doc?

I have copied a script to remove empty paragraphs from a google doc & I can run it from the script editor. It says in the script it will operate on the active document but I don't know what that is and don't want to just run it without knowing what doc it will execute on if any. How can I run this from the currently selected document? Is this possible?
There are 2 ways you can use a script (follow the links to read up on these things):
If you open the script editor from the document it means that your script is attached to that document and it's called "container-bound"
If you create a standalone script file in https://script.google.com/home (or just your Google Drive) then there is no such thing as ActiveDocument as it's not container-bound.
You can use openById() or openByURL() to specify a document that you have access to, however, you need to specify an ID or URL (the ID is the last string in the URL) so the script cannot take a random document and edit it unless it accesses your Google Drive data and looks for a file by name. If it works just with the Google Doc it will not need access to your Google Drive and before you run the script it will request access to different things just like in Android.

Do Google Apps Scripts have a Copy URL?

I'm wondering if there is a way to share a link to a Google Apps Script file that forces users to make a copy of it? Using Google Docs, you can append /copy to the url. For example:
https://docs.google.com/document/d/19yoQ71RcqNsYgPmZHzw96G_QH05hC20sWxk_ktahpXY/copy
This will force users to make a copy of the original document. I've been trying to do something similiar with a Google Apps Script file.
I've tried appending copy to the URL like this but it doesn't seem to work. As a potential work around, I could just use embedded scripts and share the Sheet/Doc/Form.
Anyone know of a URL parameter to force copying of a Google Apps Script file?
You can use this format to quickly make a copy of any public Google Script.
https://script.google.com/d/SCRIPT_ID/edit?newcopy=true
See example.
There is no way to do this since the new editor has been rolled, have reported it on this issue:
https://issuetracker.google.com/issues/198266388
You can manually make a copy on the new editor by going to the "Overview" tab, and on the top-right is the button to make a copy.

How do I access my app scripts?

I work for a university which uses Google App for EDU. Recently, I decided to begin testing app script to see how it could be of use to our organization. I have been able to create new app scripts and run them without issue. However, I have found that once I close the browser editor tab, I am not able to retrieve any script I've wrote unless I have the editor url saved (ie. I dont see any of my script in my google drive). Is there a particular app script site where my scripts are listed?
Thanks,
Bryan
The long method i use to get to see all my App Scripts is:
open an existing spreadsheet, or simply create a new spreadsheet
go to Extensions > Apps Script
click on the "Apps Script" logo in the top left corner
This will take you to: https://script.google.com/home
The short method is just to have that link (above) saved on browser toolbar and click it whenever i need to.
to be able to starts new script from the drive you have to connect script app to your drive using the Browser interface like below :
from the connect more apps at the bottom search for "script" and add it.
If you created scripts from inside a spreadsheet, they are tied to that sheet and will not show up in Drive; you can find them via the "Script Manager" menu in that spreadsheet.
All standalone scripts will be visible in your Google Drive. Did you write your script inside a spreadsheet or a Google Site ? If so, you have to open the spreadsheet or site to see your script.
If you indeed have a standalone script, make sure you click the 'All Items' on the left hand side of Google Drive or use search.
If you've created a new script from script.google.com and have saved it, it'll appear in Drive under the root My Drive folder.
If you created one from inside of Drive by clicking the red Create button then Script, it'll be in the folder which you last clicked on before clicking Create. If you don't remember what folder you created the script file under, click the Recent folder name to find it.
If you've started one inside a Form , Sheet, or Doc you'll have to remember where the Form, Sheet or Doc was located in Drive.
You can search all your scripts in Google Drive using app:"Google Apps Script" or by selecting Google Apps Script under Opens With from the drop down menu.
As pointed out by #Mandy, this assumes you have added Apps Script as a connect app. See answer from #Serge on how to do that.
Try the handy dashboard/central location for scripts:
https://script.google.com