I am looking to solve the following situation.
I have a spreadsheet that is my "builder sheet" within a spreadsheet. It has several complex formulas to create resistance training programs for athletes I work with.
I would like to make it so that I "build" the program in that spreadsheetsheet/workbook. Then "on command" duplicate that finished program into a spreadsheet/workbook of my choice. I would need the duplicated copy to be independent and retain all formats and values from the original and does not refer back to the source. This is so that I can change the "builder sheet" to the next program I need to make and repeat without loosing any previous made programs.
As I am a sport performance coach, this would save me a lot of time if this possible.
I understand simply spreadsheet functions but nothing within script languages to accomplish this.
Thank you in advance
This is problem can be solved without any scripting. There are 3 solutions, choose what is better for you:
duplicate an entire spreadsheet with the "builder sheet"
duplicate only the "builder sheet" to the any other spreadsheet on your Google Drive
duplicate only the "builder sheet" in the same spreadsheet
Related
I have 50 google sheet files for 50 students. They need to key in their answers in their own google sheet file when they are asked to do so. I have a main google sheet to consolidate their data by using IMPORTRANGE formula. This is my formula:
=QUERY({IMPORTRANGE(...);IMPORTRANGE(...);IMPORTRANGE(...);...},"Select * where Col1 is not null")
I will have 50 IMPORTRANGE in the formula. So as expected, the main google sheet is very lag when the 50 students start to key in their answers at the same time. Sometimes, the formula will show #Value when all the students started to answer the questions at their own google sheet file. I need to keep refreshing the main google sheet so that the data will come out, but it will disappear again in a short while then I need to refresh it again (although it will settle down once most of the students finished answering the questions).
I know that using IMPORTRANGE is really not an efficient way to consolidate their answers in main google sheet file but I don't have other better way.
I tried to write a script so that they can send in their data by clicking the button assigned with the script. However, all the students need to go through the authorization process when they run the script for the first time. They don't know how to proceed when they saw the authorization process (not very good in using computer).
May I know is there any ways or tricks that I can use to solve the IMPORTRANGE issue? Or there are some way to write the script where we are not required to go through the authorization process when we run the script for the first time?
Hope to get some advice and help on this as I couldn't find a better way from Google already. Any help will be greatly appreciated!
If I understood correctly what you are looking is that your spreadsheet show in real-time the data being entered simultaneously on 50 different spreadsheets. I'm afraid that Google Sheets is not the right tool for what you are trying to do the way that you are trying to do it. Basically you have two options : change it or use a different tool.
It's not a good idea to have and array of multiple IMPORTRANGE functions that are being edited simultaneously because while the official docs says that IMPORTRANGE functions are updated every 30 minutes when the source and the spreadsheet having formula are opened at the same time the import is done practically immediately and could happen multiple times during the recalculation making causing it to start over an over again.
Replacing the above array by script might help only if you are open to not have the destination spreadsheet updated on real time as scripts are slow.
Replacing the above array by a program that uses the Google Sheets API also might help only if you are open to not have the destination spreadsheet updated on real time as the spreadsheet refresh.
Regarding running a script without requiring authorization that is only possible when using simple triggers and / or removing all the scopes that require authorization to run. Please bear in mind that you might create installable triggers to run other using the authorization of the user who creates them.
Related
Combining multiple spreadsheets in one using IMPORTRANGE
Why do two users sometimes see different values from importrange?
Multiple IMPORTRANGE
Using that many IMPORTRANGE formulas is definitely a bad idea. What I'd suggest you to do:
keep a list of all your student spreadsheet in your main document
write a script that will browse through all of the spreadsheets from that list and copy/paste values into your main document
create a time based trigger that will run the script every X minutes (or hours), depending on how accurate you want the results to be
This is a simple solution, but efficient. Depending on the amount of data and number of students/spreadsheets you may consider other solutions (like writing a cloud function that will do the same as the script) but I think this will work for your use case
I have made a macro that takes a set of input data, transfers it to a master data table, graphs trend lines of the data, and then clears the data entry sheet. All sheets are protected to avoid employees from changing or deleting data that has already been entered and only the cells which require data entry are available for editing by the employees who I've shared the sheet with. The macro works well if I try to run it but if another employee attempt to run the macro they get an error stating they don't have permission to edit certain ranges.
When I wrote the Excel macro for the same task I was able to unlock the sheets up front, transfer the required data, and then re-lock the sheets but can't figure out how to replicate this type of behavior in Google Apps Script.
The Protection class on the Google Developers page did not prove to be helpful, since I kept getting an error saying the function protect could not be located in the Object spreadsheet. I also tried the addEditor function without much luck. This is my first Google Apps Script and I've been trying to learn as I go but this project is proving difficult.
Thank you to #Tedinoz for helping me realize you can rename the onEdit function so long as you designate 'e' as a function input. I was able to use an Installed Trigger on the sheet set to run RenamedonEdit(e) whenever the sheet is edited.
I'm running an online booking sheet for my local squash club (dragging them into this century!) and need to find an easy way to automate navigation to the current date when #1 opening the spreadsheet, an #2 switching sheets while the spreadsheet is open. Without the feature, people will have to endlessly scroll through the season to find today's date.
I've run a formula in column A that will place an * on the row that =TODAY() and would appreciate a bit of advice from people with script writing skills as to whether it would be possible to go to that cell on start up, and when we switch between sheets (we run 2 courts, on separate sheets).
As always, help is very much appreciated, and hopefully there is something that can be introduced that can help.
[edit] I suppose the simplest way, looking back at it now, would be the following I just need to learn how to code it:
OnOpen - Set the active sheet as "COURT 1"
Set the active range for the function as A:A
Go to the last modified cell in that range (as it's always going to the be the cell that I want).
The script should then repeat the process for "COURT 2" and then return to "COURT 1".
Copy of the spreadsheet can be found here:
https://docs.google.com/spreadsheets/d/1NBom_qB9AM_LG2lgrGjNRDbxbSGysVj8H6AXqdgKWD8/edit?usp=sharing
Thanks :)
Mark
Some key concepts that might help. I highly advise that you learn how to script so you don't go asking for code each time you want to modify something.
To run a script upon opening the sheet, you can make use of onOpen() trigger. On the same note, you need to be aware of this trigger's Restrictions.
To operate on another sheet within the same SpreadSheet, use setActiveSheet(sheet). When the sheet becomes active, you can now do operations on it. Check the SpreadsheetApp for more docs info.
Firstly, forgive my bad english and my little knowledge of GAS.
I have an SpreadSheet that will be programmatically copied about 500 times (one copy for each student).
Teachers will fill in the attendance of the students; and parents will be able to view and insert comments.
Deploying code is quite ready, but while testing I have found THIS ISSUE:
In the template, I have named and protected lots of ranges, in order to teachers not to spoil the sheets. If I share the template, solution works. But If I COPY the template, either manually or programmatically, the protection disappeares in the copies, although the named ranges are still there.
For my distress, I have read in another message that range protection cannot be set programmatically, so I will not be able to restore the protection that way.
Any suggestions?
You might want to check this out.
It sounds like you have to do a 2 step process: copy the template creating a new sheet and then copy the template permissions to the new sheet. Good luck
I'm new and appreciate help on my question!
My spreadsheet acts as a sales tool, where info is entered in various cells to run sensitivity analysis. Once the salesperson picks a desired option they "submit it". The data submitted is then stored on a separate sheet in the spreadsheet (call it the "database").
I want the database sheet to store all user submissions. The problem is when multiple users are using the sales tool worksheet at the same time, the info they enter gets overwritten by other user's inputs before they can submit.
I'd like multiple users to be able to use the "sales tool" sheet simultaneously without overwriting eachother, but still be able to submit data to the "database" sheet.
Appreciate ideas?
You can use the Lock Service to take a lock on the spreadsheet and then release it once you've written to it.
Besides the Lock Service (already mentioned by Srik) there's the Sheet.appendRow function, which is way easier to use and much faster. But only makes sense if you're inserting new data to a sheet and not really writing to the same cells.
Can't you use a form?
This way people could insert data without actually modify the spreadsheet...