Google Form Event / Spreadsheet Cell Move Query - google-apps-script

I'm no programmer or anything of the sort. I have a Google form whose output I need to manipulate in a particular way.
The obvious stuff: When a response comes in I provide my folks at work a cell on the sheet that contains a copy of the form's output, outside of the form data area, to indicate that a particular individual has taken ownership of the response and indicate next steps--call this "spreadsheet only data". No problem adding a cell or two of course. However, as responses come in, the list will get long. So I'd like to sort based off of the response timestamp to bring current responses to the top. Again, no problem...for the form data. However if I sort all new responses to the top my spreadsheet, the "spreadsheet only data" will of course not move with the associated form data. Google forms are easy until you need to track additional data after form submission.
I have tried to abandon sorting and use a script I found to send users to the last edited field, thus providing the ease of sort without the sort problems, but that is just confusing for multiple users. Google does not provide a way to insert cells per se, but it does seem to let me get ranges and move them...as best as I can tell from pawing at the intricacies of scripting found in these forums and the older. This is beyond me if possible, but would it be possible to write a script that on form submit triggers to select a range of columns and move all of those selected cells down 1 row? I don't want to specify selected rows to be moved, just columns, given it is indeterminate how many may be present at any time.
To be clearer, I hope, the issue is that, when sorted, the "spreadsheet only" data will not move down with each new form submission, I hope to find a way to rectify that so that my folks aren't scrolling forever to get to their new response, as they would if I just kept the form data unsorted, and since multiple users make the any "go to last edited cell" solution problematic (the only other solution I can think of to make the unsorted list user friendly enough to where folks wont hate the process).
Thanks for anything anyone can do.

You can set up a filter by selecting just the header rows from the form submission table (gray box) and selecting "Filter" from the "Data" menu. This filter is also added to the "Spreadsheet Only" column as well.

Related

Data entry form responses directly to a template

I have created a data entry form in Google Sheets, and would now like the data to be placed in my templates cells automatically. The user fills out a form, and ideally the answers would fill out the template and execute the calculations automatically. Is this possible?
My key questions are to
create a new tab with a template for each new data entry (results in a row in the data tab)
place entry-values to the tab to execute the calculations
I can also create many duplicate tabs of the template and place each answer to the specific cell manually, but I don't know how many entries there will be.
I have tried to create a new tab with new entries, but the tab is missing my template. I tried to link answers to specific cells, but did not know how.
If I understood correctly, you are using Google Forms to collect data and store the responses in a Google Sheet.
If that is correct, the best way to manage that input data adding calculations or other extra fields is to use a different tab.
F.e, if your form is collecting responses in tab "Form A", then you need to
Create another tab (let's say "curated A responses")
Import the data from "Form A" into the second tab
Add more fields, calculations, charts... whatever you need.
The simplest way to perform step 2 y using ='Form A'!A:A for column A and so on.
You write that into the first column of the second tab and it will populate existing and new values automatically.

Get multiple values from onChange row event

Am stuck. Have looked high and low for a method to pull multiple edited values from a google spreadsheet row. Have trawled through the google App Script list of commands. Nothing found.
A form is submitted to a google sheet that can change multiple columns per row per event.
Basically, I have an onChange(e) script that reads the changed row. It is installed and working. I can pull from the changed row single values, row and column details etc. However, despite using a variety of combinations I cannot pull a multiple row changes from a form that updates the row with multiple column changes per row. I have tried array variables all to no avail. It still only pulls a single column change per row. Have also tried A1Notation again to no avail.
Is there any way to pull changes in columns 3, 9, 17 for example?
I am happy to work through the problem if someone can just let me know a single line function command or a way that it is done. Is there something like columnChanges = [ e.source.getXXXXXX().getYYYYYY() ]; that will allow me to pull array variables that have the changed values?
Any help appreciated but I am now desperately stuck with this and prefer to avoid keeping duplicate spreadsheet and then cross checking what has changed between the two.
If you are using a Google Form to submit values into your spreadsheet, then you could use a Form submit trigger instead, and you can easily get all changes out from it.
Also, depending on your script, you might actually be only listening for one of the Edit events, which also triggers Change.
Share your script to get more specific help.

How do I lock a cell's copied value determined by a formula and prevent it from updating when the referenced cell in formula does?

the sheet I'm working on generates a request number on the very first submission a user makes of a google form based off of information the user inputted in the form and a timestamp. Now, because I need for the user to be able to edit their response later which causes the form to be re-submitted, I want the request number not to be regenerated, and to stay the same as when it was initially generated. Is there any way to prevent a cell from changing from its initial value when it contains a formula that references a cell that updates?
Here is the formula contained in the cell I don't want to update with alongside its references:
=ARRAYFORMULA(ARRAY_CONSTRAIN(if(ROW(A:A)=1, "Request ID", if(D1:D="", "",C1:C&"-"&G1:G&"-"&N1:N)), MAX(if(D1:D="",0,ROW(D1:D)))-ROW()+1,1))
The formula appends different values received from the form together to create a request number (formatted as essentially C1:C-G1:G-N1:N, timestamp-System-initials) and the arrayformula and constraint ensures the formula is copied to each row in the sheet that contains a form response so far. I want this request number to stay the same as it's initial value, even as columns C, G, and N change.
Edit: Not really sure how I can provide a search history on what I've tried so far because I've been searching for anything I can to fix this problem because it's important. I've looked into indirect referencing, absolute references, considered using PropertiesService (Google Apps Script) in order to store whether the request number has been initiated before and got stuck there, considered copying the value into another column to store it but again the autoupdating feature that accompanies linking cells of course still remains an issue. I'm stuck on what kind of function/workaround I could use to achieve this. Look forward to your thoughts. I've also tried a number of other strategies as well.
Since formulas recalculate each time the spreadsheet is recalculated using a formula is not the right way to keep the original value on the current spreadsheet version. The way to achieve this is by using a script to log those values.
There are already a lot of questions about using a script to log values from one sheet to another. Here are few examples
How to Get (& Set) cell values from one sheet to another in Google Sheets?
I want to write a script to read and log values of a specific row and copy them to a new sheet

lock google sheet cell once data is entered

I am looking for a script that will allow for a cell to be locked once data has been entered.
For instance I have a sign in sheet that has several columns.
ColumnA= Student Name, ColumnB= check box for checking in, ColumnC= check box for checking out, ColumnD= Time, ColumnE= Dropdown list for reasons.
My desire is that once data is entered the cells are locked so that once StudentA inserts their information then StudentB that access the google sheet at a later time can not purposefully or accidentally adjust StudentA's info.
Is this a possibility with a script, I know that I cannot do it with conditional formatting.
Thanks
It's cleanest to do it with a form. Do the students need to be able to see each others signins or their own in retrospect?

Linking google forms to master & children spreadsheets with automatic updates

I have a two-part question about master/child relationships in workbooks. I have beginner experience with writing code for excel & google spreadsheets so any extra detail would be truly appreciated.
Here is what I'm trying to achieve:
I want to make a google form to collect a set of data for (potentially 100's of people). The option to make changes to the form after submission will be enabled, so the data flow will be pretty dynamic. I've gotten as far as setting this up and creating the master spreadsheet where I can view all of the responses. But there's too much information in one spreadsheet and I'd like to make some child-workbooks to simplify the viewable data for various needs. So here are my questions:
1) How would I write the script to create a child worksheet from the master worksheet with these conditions: on run create a new worksheet called i.e "Child 1-Basic Info", delete all the columns and shift left with the exception of the ones I explicitly want to keep (based on the cell value) i.e "Name", "Age" & "Interests". Bear in mind I would want to eventually create multiple children workbooks, but basically do the same job each time. Just different column parameters i.e "Child 2-Education Info".
2) Along with this, I want to make sure that these children will be automatically updated every time someone submits a new response from my form or updates one they have already submitted. Essentially, the goal is to have any changes in the master ripple into all of the children. Also keep in mind that every time someone submits a new form, the row numbers will change. So the children will need to also recognize this change and update accordingly.
Thank you all in advanced!
With the QUERY() function, you can have secondary sheets that will dynamically update, with no need to use scripts at all. See more here.
Here's an example, a spreadsheet with rows of form-submitted data:
On a secondary sheet in the same spreadsheet, cell A1 contains a query formula that selects only the columns you asked for, "Name, Age, and Interests".
Every new form submission or update will result in recalculation of the query, so it will be kept up-to-date with no further intervention.