Google sheets import macros on multiple spreadsheets - google-apps-script

Google recently added a feature where you can create custom shortcuts by linking it to Google App Script code. It seems pretty good and useful, except it seems the macros need to be setup spreadsheet by spreadsheet instead of in general across all spreadsheets.
I don't know about you guys, but I have multiple multiple Spreadsheets... close to 1,000 Spreadsheets that I edit sometimes. It would be impossible to import the macros one by one spreadsheet. Does anybody know how to do it for the "environment" as opposed to just one spreadsheet?
Seems like a great improvement for Google sheets, but kinda useless for me because I use so many spreadsheets.
Edit: I want to be able to write one macro and use it in any spreadsheet. I'm confused on whether this can be done because on one hand I read the docs and it said macro can't be distributed, but on the other hand other people have said you can do it by using GAS.
One of the comments below is absolutely correct, it is like the personal.xlsb excel workbook concept. In my opinion, shortcuts are useful only if they work all the time, it is a habit thing. It only is useful when it is consistent.
Google built-in shortcuts are useful because they work across all spreadsheets. If you had to set it up for each individual spreadsheet, I bet you no one would use them.
I wish google build in a developer mode or something that make them work for each spreadsheet without doing anything. I understand there are security concerns. But Google can figure it out.
If someone knows how to do it with GAS please post.

Related

Can I have multiple toasts in GAS?

I am coding an application for Google Sheets and when searching for duplicates in a sheet I want to inform the user. But the duplicates appears quite one after the other and it seems to me that there is only one toast displayed at a time. I was not able to find any way so the older ones would stay.
Is there a way to solve the using toasts? Or could you recommend any other solutions?

Is it possible to write equations in google docs (like integrals or limits of functions) from google apps script?

I would like to write equations in google-docs but I would like to do it from google apps scripts.
The reason I want this is because I have to do some reports and they involve doing the same calculations a bunch of times over a table of data, and yes, I have to write the same questions every time.
So I would like to automate this, one of the requierements is that the final report has to be written in google docs, so latex is not an option.
You can do this with the free add on called Auto-Latex Equations add-on for Google Docs. It replaces all the text between $$ signs with high-quality images of the equation.
Basically your tag becomes the delimiters, like $$55 + \sqrt{5}$$ and renders all or one of the equations. If you mess up, you can always undo one or all the equations.

Getting a list of active file viewers with apps script

I've been googling for a while but have come up with no results that tell me I can't, but no results telling me I can.
What I'm looking for is a way in apps script (or anything in their .NET/Java/Python...API) to give me a list of people who are actively looking at the sheet when I ask. I tried getViewers but it gives me a list of all people with access, not the ones looking at it currently. If I wanted to do some data manipulation but didn't want to do it when people where in the file, or if I wanted to save the user emails of people who were in the file. It seems like it's part of analytics but I can't find anything that does what I want.
We have a working version that does some on open magic/button script trigger but this requires the user to authorize and would like to improve the process and remove the authorization step.
Anyone know a way to pull the list of people who are currently viewing a sheet/doc/slide?
It seems that this is not yet supported in Google Apps Script. I've been searching for this feature but unfortunately can't also find anything related. (Someone please correct me if I'm wrong or missed something related to this.) You're right that you can get the list of viewers but not the ones currently looking. I guess you can file a feature request for this.
If there is functionality missing from Apps Script that you would like to use, you can file a feature request on our Issue Tracker. Please describe the specific functionality you would like to see added, as well as reasons you think it's important. If possible, include specific details about your use case and the new opportunities the feature would allow for.

Sequencing large scripts in Google Apps Script

We use Google Sheets to store and manipulate event-based data from the users of our web application. Recently, I've been using Google Apps Script to automate this data manipulation process, and now I'm looking for some advice.
My scripts were working well for a while and then late last week, I started receiving the error, 'Exceeded Maximum Execution Time'. I received this error on two of my scripts that worked fine the day before, with no edits in between. I'm working with a lot of data and have even hit the 2,000,000 cell limit on my spreadsheet a couple times.
My goal is to be able to sequence my seven scripts together so that I can fire them all with one trigger. How can I do this without hitting the max execution time error? Sometimes, my spreadsheet will crash when I just try to delete one of the sheets within it. Could the size of my spreadsheet be causing the scripts to fail?
I've done my best to follow best practices outlined in Google's documentation, but can anyone recommend best practices for spreadsheet and script organization?
You might be interested in a tool written by Bruce Mcpherson for massively parallel processing in Google Apps Script.
http://ramblings.mcpher.com/Home/excelquirks/htmlservice/parallel
http://ramblings.mcpher.com/Home/excelquirks/htmlservice/parallel/implement
Here you can find the documentation related to quotas on apps script, as you can see the script runtime is 6 mins after that, the server will stop the script and throw an exception as, as you are experiencing.
If you are already applying Google's best practices, try to find where are your bottle necks.
-Do you need to read the complete range of data or just a part of it?
-Is there any information that you could store (e.g. in cache or properties) so you won't have to calculate or read again?.
-Are you tracking the time for each script?
-Are you reading the whole range of data on every script? or reading it once and passing it as parameter to the other scripts?
hope this helps.

Is it possible to limit the controls/formatting allowed while editing in Google Docs?

I want to develop an academic papers repository system in which students can create/edit their docs. In this regard I NEED to take over the Docs Interface (e.g. a user CANNOT change font size). Digging into Docs (https://developers.google.com/apps-script/guides/docs) I've not found anything that allow me to get that job done!!!
The user will log into my app (it doesn't matter if he/her has a Google Account), cause I want full control over the docs.
So, I need to create an app with those requirements. Is it possible with Google Docs ???
Best regards,
Romualdo Rubens de Freitas.
As Bryan said in the comment, you can't disable the formatting tools... the best you could do is to write a script that continuously "reformats" your document, setting font styles, sizes and other format parameters to a value you choose.
This script could run on a timer to let it run periodically. I've written such a script for spreadsheets to keep the presentation the way I want and it works nicely... I guess it will be a bit trickier in documents because there are a lot more format parameters but it should be possible.