Macros is not availible when using downloaded google sheets file - google-apps-script

I have downloaded a google sheets file with a premade macros in it. When I went to Tools to look for the Macros tab, there was none. Anyone know how to find where it would be in this case or how to fix this error?

According to the Google Sheet Macros Documentation, there are a couple of things you cannot do with them.
When I went to Tools to look for the Macros tab, there was none.
In this case you could be facing an issue if you don't have the permissions for the file, you need edit permissions to be able to access the script (how macros are stored). if you downloaded the file and are opening it in another app, it will not work (again, as per the documentation above).
To be able to access the macros you need to be in the original Sheet, with edit permissions to be able to see/modify them. If you're accessing them externally you will need to create them from scratch.

Related

Google Sheets Script not sticky

I am trying to create a custom function for a Google Sheet. to do this, I start from within the Sheet that I want to use the function, I then go to the menu Tools|<>Script Editor.
I then write a function. Name the file. And save it.
But, I can not use this function. Error #NAME?
Then if I close the Script Editor and open it again, it's like I have never been there. It presents the same form you see when you first start.
From an OP comment
I have discovered the issue, but not the solution. When the script editor is opened it switches me to another Google account I have. So I switch back. But then I am presented within a screen saying Acess Denied and making me ask permission. To whom and what for I am not sure.
The solution to the root cause of the problem depends on Google, fortunately there are several workarounds.
Use Chrome in incognito mode with all the extensions disabled, then sign in on only one account (the key part is bold)
Use another web browser or web browser profile. Sign in on only one account (the key part is bold)
Signout of all your Google accounts, then sign in first on the account that you will be using for developing your scripts, then sign in on the other accounts. This still migth be problematic under certain circunstances.
Also, as good habit, when you click Tools > Open script editor to create a new bounded project, the first thing that you should do is give a name to your project.
Another god habit, before testing a custom function, be sure that there isn't a project file with a red asterisk (unsaved file). Contrary to spreadsheets, the Apps Script files aren't automacatily saved when a edit is made.

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 Sheets Script Editor View Only

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).

Avoid Open ScriptEditor of Google Spreasheet

In my google spreadsheet, my scripts and custom function already work. However, I want to prevent other users from accessing the script editor, but they should be able to access/run the custom menus.
Is this possible, if so could you point me in the right direction?
If the user has Edit access to the document they have access to the script. If you need to remove access to the script you will need to publish it as an add-on. This is a pretty simple process especially if you are publishing it for your own work domain.
https://developers.google.com/apps-script/add-ons/

Spreadsheet Editor's Ability to Run Scripts from Library

I will be maintaining Google spreadsheets for 100 different schools. Each school's spreadsheet will have similar functions (e.g., jumping to a certain cell based on the date or creating a note in a certain cell based on inputted text) and multiple people will have access to edit it (e.g., principal, teachers, coaches, etc). I imagine that creating a library is easiest for this purpose since the functions are the same for each spreadsheet! For example, the script file for each document uses the onOpen() event to call .addMenu(). Then .addMenu calls a wrapper function and this function calls the "jumpToToday" method in my library. (I saw the posts about how the library method cannot be called directly from the menu, so that is why I did it this way). I have two questions:
When I (the owner) share the spreadsheet with an editor, the menu shows up, but when the editor selects one of the menu options, the script returns the error:
You do not have access to library ExternalSupport, used by your script, or it has been deleted.
After I saw this, I shared the library file (Can View) with the spreadsheet editor and then it worked. Do I have to share the library (view only) with ALL editors of the spreadsheet so that they can run the functions? If so, that's fine (I was just trying to avoid it because most principals/teachers/coaches are not techie, so I didn't want to confuse them by sharing a file of code...I just want them to use the spreadsheet).
Because the editors of the spreadsheet will only be able to view the library, it seems like they only have access to the Version that is selected (even if dev mode is on).
When I update my library to another version, do I have to go into the Script Editor of all 100 spreadsheets and then go to Resources > Manage Libraries and update the version? Or is there a way to make all files use the latest version of the library?
1) Yes. According to the documentation
you must grant at least a read-level access to your project for all potential users.
I agree that this may be confusing for other users but at the moment it is necessary.
2) There is no way to make a file use the latest version of a library. Though, there is a way to make a file use the development version of a library. For this to work you need to grant editor-level access to your library to the user. However, bear in mind that any changes that you make to the library will be reflected immediately at the user's end. You can find more information in the documentation.