Send form response details to user that completed the form - google-apps-script

I have to migrate a Microsoft Excel 2010 file to Google Sheets. This file as a userform that allows a user to reply to a few questions. Those answers then goes to the excel sheet and pass by a various number of manipulations before giving back the results to the user.
I created a Google Forms and I migrated my Excel sheets to Google Sheets.On completion of the form, GForms write the information in GSheets. But then I'm stuck to bring back the results to the user.
On completion of the form, GForms write the information in GSheets, but I don't know how to bring back the results to the user that completed the form.It can be by mail, from a new GSheets, directly in GForms or else.

Related

Is there a way to fetch url for google sheets from a different spreadsheet using apps script?

I am trying to create a log for all the PDIR reports that are generated in our company. For this purpose, I have written an apps script code that brings forth a format from our master sheet when a product part no. is typed. After filling in the information it allows the user to press the submit button that transfers this PDIR to a PDIR database where all the PDIRs are being stored. Now, what I want to do is, add a feature to the submit button that automatically creates a log for the PDIR report. I have attached the format here for reference. I want to find a way to extract the URL of a particular sheet and add the link in the log next to the invoice, so my employees do not have to waste time finding different invoices and can just search for the invoice no. and have a link ready to take them to it.
Long story short, I want to find a way to get a URL of a sheet from a different spreadsheet using apps script.

Google Admin Directory SDK Users.list() Returning Old, Not Current, Data

I am working on a project for my company, that well is kind of complicated. I am not sure if I will be able to explain it as well as I need to.
Basically, this is how it works:
A user fills out a Google Form that represents a user in our company, either new or existing
My Google Apps Script gets the last form response, triggered on form submission
That script then relays that last form response data to the custom schema fields I set up on Google Admin
Once the user is updated, I grab ALL the users in the domain and paste them into a google sheet
The spreadsheet represents our company roster. We originally just tried to maintain the data solely in a spreadsheet, but it became a mess.
To solve this, we introduced the google form, which can validate all data. Furthermore, our data is backed up to Google Admin (within custom schema). The spreadsheet is solely for display. It is bulletproof. Upon refresh, it pulls the data, and re-writes the sheet.
However...
I am noticing that after the form is submitted and the user is updated in Google Admin, and then all the users are pulled from Google Admin, the user that was updated isn't showing as updated in the spreadsheet. However, if I refresh the page, then the correct data shows up (I have another script that triggers on spreadsheet open, literally the SAME EXACT code that runs after the form submission). Why does that code return the proper data on refresh, but not when run directly after the form submission and consequent user update in Google Admin?
I really am dumbfounded and having an incredibly hard time explaining this because it does not make any sense. My boss and I both spent the entire day scratching our heads on this yesterday.
Do you guys have ANY ideas?
Is there a cached response, possibly accounting for the non-current data from Google Admin?
When I used the Admin Directory SDK API Explorer, the user modified shows as current. I just don't seem to be getting that same response when my script runs.
I am so lost. I spent 2 months developing this system. It worked in development.
Any and all suggestions are appreciated

Google script run after email confirmation

In this case, I don't have a code or screenshots to share because I honestly don't know how to even start it :)
We have a spreadsheet (Google Sheets) which have numerous scripts built into it. They run mainly based on form submission and don't require any further confirmation after a form is submitted. For this new form we wish to implement, we would like to script to run only after a user has confirmed via email. Here's the rundown:
User A (normally from the administration department) will input data into a form.
Once form is submitted, this data will be sent to another user (User B) for confirmation. We would like this process to happen over email, and not directly via Google Sheets prompt.
Once User B confirmed data is good, a script will run to compile the data and perform several actions on it.
No problem to send an email via script but how do we include a confirmation button/link to it and how do we capture this clink to continue the compiling of this data?
Thanks :)
User A Enters data into Form and Presses Submit
FormSubmit Script recovers data and sends email to user B
User B reviews data and Presses a link on the email which sends a request via a web app to complete the transaction at a later time.
You can probably customize the webapp link with query string parameters so that the transaction can be completed without any further interaction but it will probably take a couple of days of programming to complete and test the job.

Having trouble with Google script authorizations, need help remotely updating many (dozens of) Google Forms

I'm setting up an event to encourage people to stay physically active. Once someone registers, they are sent a copy of a Google Form/Sheet template that they will use to create their team. Each member of the team will enter their name, select the activity that they performed and record how long they performed it. The log Form should automatically update to list these names and activities so that the users can select from this list later rather than enter them again. The linked Response spreadsheet has charts comparing the team members activities to each other. I have a 'master' spreadsheet that imports the data from all of the team's response sheets and compares and displays them (on Google Slides) for the participants to view.
The problem that I'm having is that I would like to be able to programmatically authorize the Log Form auto update so that I don't need to do it manually every time a new Log Form is generated.
Things tried:
1) Form ranger - the Form ranger configuration can be setup in the form template, but is lost once the template is copied, requiring me to reconfigure (and authorize) the Form Ranger each new form as it's generated.
2) Use Google script to update the form with an onFormSubmit trigger. Process is working but I need to manually setup the onFormSubmit trigger, the first time, in each new Form/Spreadsheet in order for it to continue automatically afterward.
3) Updated the manifest file to include: "oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.currentonly"] When I tried this, the script generated an error indicating 'You do not have permission to call SpreadsheetApp.openById'. It began working again after removing the '.currentonly' but still required me to manual authorize it for each new Form/SS.
4) Added
/**
* #OnlyCurrentDoc
*/
to the script. This added several seconds to the script runtime but, other than that, I didn't notice any change. Still required me to manually authorize.
5) I've tried using simple triggers (onOpen and onEdit) to detect changes in the Form's linked Response sheet, but found that these triggers are not activated with the form's automated sending of data to the spreadsheet but rather when the USER manually performs the operations on the spreadsheet. So still no automated updating.
Do you have any other ideas? I appreciate any assistance that you can provide.
Thanks,
David

Google app script import CSVs

Okay. Multiple people use the scanpet app to create csv files of 3 columns [uniformly structured, no headers in csv].
I'd like them to email the created file to a gmail account, then go to a google form. I realize for this to work it's have to be done after each email submitted and that is okay... please read to end.
I'd like to make a google form with only one option, just to enter a record to trigger an event. Link the form to a google sheet. I'd like this sheet to house the script I'm asking help for in the script editor, and the google sheet to then have two other tabs named Transfer and MailOrder each with the same 3 columns as the csv files.
After the employee sends the file he completes the google form.
script triggers on form submit, and will grab the the latest csv attachment from gmail and depending on the subject line of the email (Mail Order or Transfer) add the values to the existing data entries under the tab with the same name as the subject line.