From within the Google Spreadsheet I am trying to validate an e-mail address which the user enters to one from within the domain directory. The aim is to change ownership / collaborator rights (but that is further down the line).
I have used ContactsApp.getContacts() which has been iterated through this as expected brings up a list of contacts within my contacts. However, does not go onto the Domain Directory
To confirm I have then used ContactsApp.getContactGroups() and iterated through this and then used getName() which produces a list of my Contact Folders.
My question is firstly, is it possible to iterate through the Domain Contact Directory as a user?
It appears that I am looking in the wrong place, where should I be looking.
Many thanks in advance
Neil
I think that feature is not supported yet.
see also: https://code.google.com/p/google-apps-script-issues/issues/detail?id=1822
Related
I own 2 spreadsheets. One Master and one template.
On Master, I add patients and create a new spreadsheet for this client as a copy of the template. At this moment I give the client Edit access to this file.
This worked fine. But now I have to add staff and each of them needs Edit access to each copy of the template and Read access on the master.
Staff members come and go. I wonder what is the best way to simplify authorization.
Now I loop thru all files and give/revoke for each document. This is not performing in the long run.
Can I apply permission to a folder? or to a group and just add/remove staff to this security group? I'm new to the google apps script, hope you can show me the right path.
EDIT: Now I'm here
I need staff member to have access to view the master and edit any of the copies of the template. Also, I need people from outside the organization to have access to edit their own copy of the template.
I'm not sure how to proceed.
Also, I develop all this under my own Gmail account, now I have to move this into the orbit of the organization. What are the steps?
In your case, the easiest might be to create a Google Group and share your spreadsheet with it
When the staff members "come and go" you can simply add and remove them from the Google group and do not need to touch the spreadsheet's sharing settings.
Btw, when you create a copy of your spreadsheet programamtically, you can retrieve the editors of the current spreadsheet with getEditors() and assign them to the copied spreadsheet with addEditors()
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've a public Google Sheet (everyone can access it and edit it). In it, I use a script, a function, that download a csv with the UrlFetchApp.fetch(url);.
When an anonymous user access it (without the google login), the user can view, and edit the sheet, but, the user cannot run the script. The user must be logged with a google account to the script do the working.
The stranger thing is that this sheet with this script was working for anonymous users early. This problem didn't occur before a couple weeks ago.
Do you know if the google change something about security or is it an error that I am doing?
In order to run apps script on a particular user's behalf, Google Workspace requires that user's permission, via an OAuth flow.
If a user is anonymous therefore, you can see why this permission cannot be granted, which is why the script won't work for those users.
I guess it is an intended behavior as long as the anonymous user access the sheet via shareable link. As stated in this support page, you might see a name you don’t recognize or "anonymous animals" viewing your document, spreadsheet, or presentation. This can happen when a document is shared publicly or with anyone who has the link.
Limit how people can view your file
If you want to stop sharing a file you can edit, you can learn how to:
Turn off link sharing for a file.
Prevent others from sharing files you own.
Hope this helps.
Does anyone know if it would be possible to set up a script on my Google account that triggers when a new item is shared to the email and then automatically shares it with another email address?
I use a personal Gmail account, but whenever I do school work documents are always shared with my school email and it is a pain to have to share everything manually or keep switching accounts.
When I looked a few weeks back I was unable to find a way to have a script trigger on new shared items, but I am new to these scripts so if anyone has a suggestion I would appreciate it. Thanks!
I don't think you can actually triggers on new items. But you can write a script to read the Drive feed to easily check if there's new files.
Such script would still have to be triggered on a time-driven basis, so you wouldn't have "instant" access on your second account. Also, if I'd write such script, I would just create a folder, share it with the desired accounts, then use the script just to move the files to this folder. This approach has the benefit of easily allowing you to check which files are shared (with your specific account) and which aren't. And since folders are actually just labels in Drive, it is not any problem if you like or need to have your files organized in another folder structure.
By the way, have you seen Chrome users feature? It helps a lot when working with multiple accounts.
I've got an ambitious first Google Apps Script project for use in a Google site.
Using a spreadsheet database I have a list of Google users that each have a unique URL to a service at a non-Google website.
What I need to do is place a link in a Google Site that will
Get current user id based on logged in user
Interrogate spreadsheet database for the unique URL based on Google user
open the unique url in another tab/window
Any pointers or code snippets would be very much appreciated, especially around minimising user authorisation. As it is a Google Apps domain the script could be pre-authorised as a trusted script if that is even possible.
Thank you
I did write a site gadget that does exactly what you want, (except that users have to enter their name because the site is public and I wanted to avoid asking authorization), you'll find the code and explanations here, I'm not going to reproduce the whole code here but in short it allows to enter a name (even partially) and looks for any match in a spreadsheet list then shows a link to an individual url. It is also possible to see it working on the same page.
(see page bottom, it looks like this)
To answer your second point, there is no way to avoid the authorization process, the idea of 'trusted source in a domain' has already been mentioned in a few discussions with project members but for now it is not possible.