I'm currently working on a Spreadsheet, and I'm up to the point of creating either a button or checkbox to SELECT and COPY a row to another sheet as part of an efficient archiving system. For e.g. the user will select their row, click the button and the row will be copied in the mentioned sheet. I'm still quite new to scripting in Google Spreadsheets as a whole. I personally wanted to head into the direction of using a button, but I'm open to suggestions.
Thank you all!
I think that works (you will be assigning a script/function to an image you upload, and then in the function use .getRow() on the active cell). Here is some advice that could save you some time. For your use case, instead of using a button, consider using the QUERY command:
You have a table in "sheet1" with some columns:
In that table you have an IMPORT column. You can use data validation on that column so that it is a Yes/No dropdown as well.
In a separate sheet, you write this which picks out all the rows with "Y":
=query(sheet1!A2:D1000,"select A,B,C where D='Y'",0)
And that will output this (minus the headings, which you can customize based on the last argument of the QUERY command):
Related
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.
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.
I am currently working on GAS project, for the moment I have a table in a sheet and the idea is that my collaborators will be able to choose the format of the table, which column and which row they want to save. I thought about using the hiding column and row features but is it possible in my apps script to get only the data which they chose to save and not the hidden data ? Thank you for you answers
Apps Script works analogously to the Sheets UI
Explanation
If from the user interface you select the desired data by "click&drag", the hidden columns located between the start and the end column will be also selected (and copied). Instead you need to select the data of interest manually with "Ctrl" and click, see here.
How to transfer this to Apps Script?
Apps Script features the method sheet.isColumnHiddenByUser(columnPosition) (and isRowHiddenByUser, isRowHiddenByFilter etc.). You can use it to select only the ranges / the values of a datarange in columns and rows that are not hidden.
This implies the implementation of loops and conditions statements, so is not necessary an elegant solution.
I would like to add a script to a button I created in Google Sheets. I would like the button to add a new column before my "Month Loss" column. I would like the new column to copy the formulas and formatting of the column to the left.
This will provide an easy way to track my body measurements and help to determine calculate my body fat percentage.
Here is a link to my sheet: https://docs.google.com/spreadsheets/d/1DP0SQpU16YEfPWoE8IRknoqQWu0wrFagzhLflVOkn8M/edit?usp=sharing
A Pivot Table has been created though script. if you try to programmatically update the range, there is no way either because named ranges need to be deleted then re-added which causes on the pivot.
if you are adding the new row by script, do not append it to the end. instead keep a fake row at the end and insert the new row just before it. your range (named or not) will update.
Even for the google forms case you might get it to work by pre-adding all blank rows to the response sheet and make the named range include the blank ones too.
Found this Stack Overflow ticket discuss about Pivot Table, you may also check the solution offered by the community: Google Spreadsheet Pivot Table Range Update Using Scripts
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.