I have the following issue.
I have a Google Sheet that is shared with everyone within my organization(300 people) and they have to have edit rights.
But, certain users from that organization should not be able to edit or even access the file, even tho it's okay if they can just view it.
I'm currently battling this by using a script that checks the users mail(Session.getEffectiveUser().getEmail()) and if they match the address in the array that contains all the addresses it fires an alert modal telling the user they are not eligible.
However, this works but if the users simply closes the alert he/she can continue editing the sheet. Which is not desirable. :)
I've searched but i failed to find a working solution or at least the idea to prevent those few users from the organization to edit this Sheet.
Appreciate any input, thanks!
Related
I have a google sheet and I am the owner of it. My colleague often wants ownership access of it, so we have to toggle the ownership between us by changing the Status every time. Is there a way I can have multiple owners for a Google Sheet? If it means using the App Script code, I am open to it too (I tried to find a code but haven't seen it yet).
Hoping to get help from folks here. Thank you in advance.
The answer is no. A google spreadsheet can have only one owner.
There are 4 different levels of permissions to allow for flexibility and control over security and access around users:
Ownership
Edit
Comment
View
If we assume that the owner does not have special protected ranges or sheets, which can only be edited by him/her, an editor can have the same privileges when it comes to editing/modifying the content as well as being able to share the file with other users. A spreadsheet file can have multiple users that belong to categories 2,3 and 4, but only owner (category 1).
There cannot be more than one Owner at a time. Transferring ownership in Google drive will lead the documents to be organized in a single folder, titled with the previous Owner’s email address. The original Owner will still have only the editing privileges.
I am working on a application that involves multiple users. The application is based on a spreadsheet. After the user inputs information in the spreadsheet they click a button and a Google Doc template is copied and opened in a custom dialog and the user (author) writes a journal of their conclusions. The author can come back to their doc file through the spreadsheet to add addition comments.
Now another user goes into the spreadsheet and want to see the other authors comments, but they shouldn't be able to edit just view. The author is known and an admin is known but the other users may not be known at the time the file is created. And the number of users that could view may increase as time goes on.
1) What it the best way to set edit and view premission?
2) What permission can give the admin the ability to delete the authors files?
I have also posted these questions on the Google App Script Community.
Issue
Colleagues gather information on fairs and such and that information needs to be submitted. Currently they copy-paste this data in a Sheet and some data validations and such are applied on this sheet. However, data validation does not reject the input in case it's not an accepted value when you paste 2 or more values (it just gives a warning by marking the upper-right corner red). Furthermore, we are not able to set certain columns required.
Since this sheet is automatically imported in a database, it is important to have all required data present and with valid values.
Question
Would it be possible to have a Google Sites page that shows a Google Sheet, allows you to add data to this sheet and process this data when a submit button is clicked on the page?
Thoughts
I was able to find the Sheets integration in Google Sites, but the first issue I encounter is that users are not able to add data to this sheet through the Google Site.
I thought about doing this just in Sheets instead of a Google Sites solution, but this has some drawbacks:
Using a script would require user rights to edit the sheet that's automatically imported
Not very user friendly for simultaneous usage
Not an attractive interface
I'm not asking for a complete solution, but as I failed to find such a possibility I'd appreciate references to relevant documentation or opinions how this problem may be solved in the best way.
Is there a way, to make a certain sheet in Google Spreadsheets, be editable and accessible to a certain type of user, while not be accessible to another type of user?
I currently have a Google App Script project, that allows a certain user to use an HTML form to input certain parameters, and a Google Spreadsheet is automatically created for him (thus, everything in the spreadsheet is created programatically).
This new spreadsheet should have access by different "types" of users.
A "type" of user just means a specific person that has specific authority over the spreadsheet.
For example:
There are users who would be able to edit anything in the spreadsheet. There are other users who can only read it (but not edit it). There are users who would be able to access custom Menus (that allow them specific actions related to the spreadsheet), while other users should not.
For now, I solved the above problem by having 2 types of users:
1)A user that is given "Can Edit" access to the spreadsheet by the creator. This user can edit any sheet in the spreadsheet, and access every custom menu (since those are created in the "onOpen()" trigger, which executes only when the user has "can edit" authority)
2)A user that is just given a "Can View" public link to the spreadsheet. This user can only read each sheet of the spreadsheet, but not edit any. He also has no access to any custom menus.
This worked for a while, but now I have new requirements that should allow the 1st type of user, to have access to specific sheets, while the 2nd type of user should not even have read access to them.
Is there a way, using either Google App Script, or other functionality from Google Spreadsheets, to make this happen?
I know sheets can be made visible or invisible, but doesn't that affect every user, even those I want to be able to view and edit them?
If it's possible, I also want to know if it can be done programatically using Google App Script.
Is there also a way to have more functionality restricted to different types of users? What if I want a specific user to be able to edit a certain sheet, but not be able to access specific custom menus?
If it is not possible to do so, the only solution I can think of is to create separate spreadsheets for each of these "restricted features", and give "Can Edit" access in that spreadsheet to each type of user I want to have access to those features.
However, ideally everything should be done in a single spreadsheet, since I want all the information contained in a single access point, and not scattered in different spreadsheets with (maybe) little relation between each other.
Thanks
now I have new requirements that should allow the 1st type of user, to have access to specific sheets
Editors already have access to all sheets.
the 2nd type of user should not even have read access to them.
Well, that would trigger the need for either using a 2nd spreadsheet that imports the data / sheets that you only want the "Can View" users to see or you could go with creating a web app that only displays that data if you just want to stick with 1 spreadsheet (but still 2 urls).
I know sheets can be made visible or invisible, but doesn't that affect every user, even those I want to be able to view and edit them?
This is fairly easy to test manually. Have an editor hide a sheet while a viewer has it open in another window. The sheet will be hidden on both.
I also want to know if it can be done programatically using Google App Script.
yes - SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name).hideSheet()
Is there also a way to have more functionality restricted to different types of users?
If you have the users and their permissions stored some where, then you can control what functions run based on their email.
function myfunction() {
var validUsers = ['ex1#ex.com', 'ex2#ex.com'];
if (validUsers.indexof(Session.getEffectiveUser().getEmail()) >= 0) {
// continue
}
}
What if I want a specific user to be able to edit a certain sheet, but not be able to access specific custom menus?
Use the same technique as above to filter out who should be able to see menus in onOpen().
I have a spreadsheet which I want only to be modifiable when the user is using custom menu functions (using the .addMenu function). If I set the sheet's sharing permissions so that only I can edit, but everyone else can view, the custom menu is greyed out for anyone logging in.
I tried to work around this by giving the users access rights to the spreadsheet, but then protecting each sheet but the same issue occurs.
Basically I want the user to be able to add data to the spreadsheet but only when using the custom functions. For example when one of my employees wants to place a new order, he must get authorisation from the Chief Accountant to do so. I have made it so that this order request is entered into a form by the user, which then populates the spreadsheet and alerts via email the accountant that there is a new order pending approval. I want the accountant to then open the sheet, and use the menu item 'approve/deny', which will mark the approval column of the specific request as 'approved/denied'. I do NOT want him to be able to edit this column manually.
Basically I think I need the script to be able to be called by the user, but run as myself. Is this possible?
Thanks for any assistance.
You cannot do it by controlling access to the spreadsheet. The best solution for you is to have your accountant NOT opening the spreadsheet at all !
You can embed a HTML form in the email that is sent to the accountant from where he/she can approve/reject the request. To see how you can build such a system, see this video from I/O 2011 http://www.youtube.com/watch?v=96URE_-aj-8
It demonstrates a use case very similar to yours.