How to automatize the usage of google sheet add on - google-apps-script

I created an add on for google sheet and it works correctly, but each time you create a new sheet you need to click on:
Extensions -> add ons -> manage add ons
Then click on the add on and click on "use in this document" as you can see in the screenshot.
I'd like to do something to automatize, can you help me?
Thanks, best
I tried to manage over google cloud platform to find a way to do that but not found anything at all. I only need that everyone use this add on doesn't need to click on "use in this document"

Related

Google Forms + Cloud Function Integration

Image with Error:
Hi,
I am trying to build an OnSubmit Function with google forms. I have attached the picture of the error. As far as I understand, the gs script isn't able to read the property "response" from "event". I have clearly followed the Google Apps Script documentation. Can you tell me where I'm going wrong?
I would need a little more information in order to more accurately help. If you could specify why you are setting a trigger/ what it is that you want to do then I can hopefully help a little more.
However I can try to help from the little bit that I can see from your picture...
step 1 to solving your problem: Have you implemented a trigger? All I see is that you created a function called "onSubmit". Unfortunately with google script, that doesn't do anything to actually tell the servers when to run the function. For that you would need to set a trigger. I would highly recommend that you create the code through the responses google sheet and not through the form itself. That is because if you wish to use the information from the form response, then using the google spreadsheet makes it significantly easier to retrieve the information, especially if you are familiar with arrays. This is a short video of me doing the process of setting a trigger and showing you the results. The only thing I have redacted is my email.
Regardless of whether you decide to implement the code on the spreadsheet or the form, the steps for adding a trigger are the same.
What you want to do is go to your code. Click "edit" -> Click "Current Project's Triggers" -> click "Add trigger" -> and for "Select event type you want to select "On Form Submit"
The reason I specifically put "on form submit" is because that was my understanding of your problem. By selecting that it runs your selected function whenever the form is submitted.
Hope this helps. If you need further clarification, please let me know.

How can I remove a bound script from a Google Sheets Spreadsheet?

I have a spreadsheet where I first created a bound script file (via Tools->Script Editor). I then (at a later time) was exploring the File menu and hit Make A Copy. I now get a "Select a project to open" with the original "myAddOns" and "Copy of myAddOns" as the choices. I would like to remove the copy. I found it in the scripts My Projects page, but when I try to remove it the original spreadsheet also gets removed. (Pulled it back out of Google Drive Trash folder)
Am I stuck with this?
Thanks!
It turns out that (as the project owner) using the File->Delete Project once I open the Script Editor works. Not sure how I got messed up before.
Turns out that all of us can forget how to do this. Thanks for asking the question. In the new editor, this feature is found in Project Details, then to the far right. Click the Trash Can that warns "Delete Project Forever". Yes, please. Hope this helps someone in the future.

Using Google Sheets Menu with Google Apps Script

I am new to Google Apps Script and looking for some insight into a feature I would like to implement.
I am using the Google Analytics add-on inside of Google sheets to report on our site. I have already set up a script to send out daily reports, but currently still have to run the reports manually using the add-on. Is there a way I can access the add-on menu using Google Apps Script?
I'd like to add the functionality of clicking 'Run Reports' in the GA add-on menu before my daily email script. Any help would be greatly appreciated. Thanks!
I think what you mean is you're inside a sheet, and you want to be able to press Add-On->Add-on Name to run the report.
You're not able to do this unless your script is a published Add-on available on the add on store for anyone to download. Given the restrictions Google currently has in place for that, it's unlikely you'll want to do that.
Instead, you want to create a custom menu. An example found here. I'm not going to bother copy/pasting their sample, as I'd be leaving it as is.
From the sounds of it though, you might prefer to create a time based trigger. The simplest way to do this is open your script, press 'Resources' -> Current projects triggers -> 'Click here to add one now'. This will allow you to set a time based trigger to run every day for example.

auto find and replace in Google Docs App Script

I'm trying to create a note-taking template/script for Google Docs (docs, not spreadsheets) that automatically converts abbreviations into full words/phrases (ex. typing 'mgmt' automatically turns into 'management'). I can't figure out how have this happen in real-time (vs. running the script after typing is done, which would basically be a quicker find and replace).
Any tips? Or is this even possible? Thank you!
If you look under "Tools" and click "Preferences", that would be what you are looking for.
Cheers.

How do I access my app scripts?

I work for a university which uses Google App for EDU. Recently, I decided to begin testing app script to see how it could be of use to our organization. I have been able to create new app scripts and run them without issue. However, I have found that once I close the browser editor tab, I am not able to retrieve any script I've wrote unless I have the editor url saved (ie. I dont see any of my script in my google drive). Is there a particular app script site where my scripts are listed?
Thanks,
Bryan
The long method i use to get to see all my App Scripts is:
open an existing spreadsheet, or simply create a new spreadsheet
go to Extensions > Apps Script
click on the "Apps Script" logo in the top left corner
This will take you to: https://script.google.com/home
The short method is just to have that link (above) saved on browser toolbar and click it whenever i need to.
to be able to starts new script from the drive you have to connect script app to your drive using the Browser interface like below :
from the connect more apps at the bottom search for "script" and add it.
If you created scripts from inside a spreadsheet, they are tied to that sheet and will not show up in Drive; you can find them via the "Script Manager" menu in that spreadsheet.
All standalone scripts will be visible in your Google Drive. Did you write your script inside a spreadsheet or a Google Site ? If so, you have to open the spreadsheet or site to see your script.
If you indeed have a standalone script, make sure you click the 'All Items' on the left hand side of Google Drive or use search.
If you've created a new script from script.google.com and have saved it, it'll appear in Drive under the root My Drive folder.
If you created one from inside of Drive by clicking the red Create button then Script, it'll be in the folder which you last clicked on before clicking Create. If you don't remember what folder you created the script file under, click the Recent folder name to find it.
If you've started one inside a Form , Sheet, or Doc you'll have to remember where the Form, Sheet or Doc was located in Drive.
You can search all your scripts in Google Drive using app:"Google Apps Script" or by selecting Google Apps Script under Opens With from the drop down menu.
As pointed out by #Mandy, this assumes you have added Apps Script as a connect app. See answer from #Serge on how to do that.
Try the handy dashboard/central location for scripts:
https://script.google.com