How to send Google form applicants to Org Charts - google-apps-script

I need to automate the applicant and position ownership processes:
Forms> Acceptance> Plug them into an Org chart
Let me know if I can provide more use case info. I tried using Apps Script.
Thank you,

You can definitely use Google Apps Script to accomplish this.
First you need to create a Google Form the users will need to fill and get the data of that form in a spreadsheet. Once you have the spreadsheet you can start using Google Apps Script to create the users based on the data from the spreadsheet.
There is a code sample on how to create users in the Admin console using Google Apps Script here. I am assuming you will create your script so that it can add users based on the information introduced in the data from the spreadsheet, so you have the list of methods you can use here.
You would also need to add a trigger to your script so it starts running every time the spreadsheet gets edited, meaning that a user will get automatically created by the script every time someone fills the form and the responses get recorded in the spreadsheet.

Related

Can an apps script macro in a Google sheet be used by other users?

I have a fairly simple requirement for a Google sheets apps macro script - it basically pulls the values from a couple of cells in another sheet and displays them in an alert box.
I've done the macro for this and it works fine. What I now want is for anyone I've shared the sheet with to be able to run the same macro. This is where things have suddenly got a bit more involved! My questions are:
Is this possible? And if so, what's the best way of achieveing it? At the moment, the macro is not available for the test user I've shared the sheet with. I've had a bit of a look around and it seems like publishing the script as a web app may be the way to go - can anyone confirm if that is correct? Or would there be a better option? I don't know anything about web apps so just want to confirm if this is the best option before trying to wrap my head around it all.
If the sheet in question has been shared with a user, but the second sheet which the script pulls data from has not, is it still possible for the user to run the script and retrieve the data? Or would the second sheet need to be shared with that same user as well? (If it would then it kinda defeats the object of what I'm trying to achieve).
Finally, would the user with whom the sheet is shared have to have a Google account in order to do this? I'm assuming so...which is a bit of a pain, but I guess understandable.
Thanks very much
Wokaround
Following the requirements you have described I get that you want your users to trigger an Apps Script function that will alter or get data from your Spreadsheet while only granting your users viewer-only acccess.
As described here only users with editor level access can run functions on your bounded script or activate it when clicking a button in your Spreadsheet.
To overcome this you can create a simple web app with a button that will trigger your function. Users will have to access this web app to trigger the function. The good point is that they will not have editor level access to the Spreadsheet nor to the actual script of the web app (as they will just interact with its user interface).
The web app would be a different script that can interface any of your Spreadsheets editing them or getting any information from them.

create Google Sheet database accessed by different users

I've built a spreadsheet as a form by google script with one button which updates a database(a different sheet) according to the form - btn_pressed().
I want to authorize any google account I give access to - to use the form (activate the google script code), and update the database and send mail (part of the btn_pressed() process).
should I publish the script as a web app? or there's another way to do what I'm looking for
I understand that you want to automatically authorise the script for other users when they come to run the script?
I recently learnt you can only do this with certain triggers such as onOpen() out onEdit(), there is a way round this though. Please see the following link as i asked the question on here myself!
Remove authorisation required for script on Google sheets
I trust that helps

Automatic table to create a list of specific inputs

I'm trying to create a Google spreadsheet, with the start of the table a pop up window comes with a question of whether it is an Entry or Pickup.
After the decision, it should fulfill certain tasks after the election.
When choosing an Entry, a form should appear where you have to provide certain information. (The entered information should also be automatically inserted on the Google Table by the script.)
When selecting a Pickup, another form will appear that compares the information entered with the list of Google Sheets.
And upon successful approval, it should fullfill on the list in the Pickup section.
My question is whether it is possible with Google Drive to create such a script.
My question is whether it is possible with Google Drive to create such a script.
Yes.
You can create such a script with Google Sheets with Apps Script by using UI Modals. Create a HTML Form on these modals and when the submit button is pressed send the data to a custom function that places the data on your sheet.
You can have this executed when the file is opened thanks to Triggers.

How can I get a user to use script (bound to a Gsheet) to update cell in another Gsheet (user do not have edit access)?

I have a Master Sheet with only me having edit access to it. I have another sheet (user sheet) where users can add some data that I want them to update my Master sheet only via a script (in the user sheet). Is this possible?
I already have the script that can copy data from the user sheet and knows where to paste it in the Master Sheet.
I could do this easily using VBA in excel but I am very new to Gsheet and using Gsheet scripts. Hope someone can help me please.
You cannot have the user's bound script directly access a Sheet they do not have edit access to. A bound script always runs runs with the permissions of the user at the keyboard.
One possible workaround:
You can create a Google Apps Script web app that has a doPost function that edits your master Sheet. The web app should be published so that it "runs as you", and has anonymous access (which also means you should be careful how to process the requests you receive). In the bound script, you can communicate to your web app through UrlFetchApp, which can send POST requests and give you a response.
The easier way to do this is to have them modify their sheets and then your master sheet reaches out and gets the data from them on a timed trigger. Although making your own webapp would work.

Update Google Forms field based on dynamic data from a Google Sheets spreadsheet

In a Google Form we have a pull down selection list.
The list of items may change from minute to minute. The master copy of the data is in a column in a google docs spreadsheet.
When a user accesses the form, we want them to see the latest copy of the pull down list as is current in the spreadsheet.
I don't see an obvious way to do this with triggers. onOpen, for example, only triggers for administrators of the form, not users. Is there a way I can keep this form up-to-date automatically?
This is my first time in google docs, but I'm very experienced in excel scripting.
The work flow needs to be a bit different than what you've described. Since there is no ability for Google Apps Script to interact with an end user accessing a Form, there's no way to react to that. However, you can react to changes in the spreadsheet, and update the form options in preparation for the next end user.
Depending on how the options get updated in the spreadsheet, you can use an installable trigger there, to react to an edit or a change.
If the form is associated with the spreadsheet containing the choices, you can get a handle on the form using Spreadsheet.getFormUrl(), then pass the URL to FormApp.openByUrl(). Otherwise you will need to provide the ID or URL explicitly to FormApp.openById() or .openByUrl(), respectively.
That spreadsheet trigger function can modify the available selections for the relevant question by using ListItem.setChoices() or ListItem.setChoiceValues().