Google Apps Script - Tweet Approver - google-apps-script

I've been following the guide found here: https://developers.google.com/apps-script/articles/twitter_tutorial
About creating a twitter app.
I've been looking at the part below:
To get started, copy this spreadsheet containing the script for this tutorial. Once you've got your own copy of the spreadsheet, open it and you will notice the spreadsheet will be empty; that is intentional, as we won't be using any of the spreadsheet's cells in this tutorial.The first thing you need to do is publish your script as a service. To do this, open the script editor by clicking Tools > Script Editor... In the new window, click Publish > Publish as Service...
This doesn't actually work at all.
If I open the spreadsheet and click Tools > Script Editor.. I'm taken to the script wizard. It then give me the option of creating a new script. The script can only be published to gallery, or as a web app. Where is the publish as service option?
Thanks

I checked on the tutorial page and it seems indeed that the template spreadsheet has not script included...
But the full code is still published at the end of the same page so you could copy/paste the full code in the script editor (choose new code from the wizard and delete everything in there ) and start from there.
About the "publish as service" this is the old name of what is now known as deploy as webapp, the procedure is slightly different and is described here, you will need to first save a version (manage version in the file menu) and you will get 2 urls, one for development and one for use, both will run from your browser starting with the doGet() function.
The remaining part of the tutorial about initialisation and authorization from the spreadsheet menu is unchanged, just follow the tutorial instructions.
Hoping it will help you,

Related

How to easily publish add-on to avoid re-authorization request for a copied Spreadsheet?

I have created a Google Sheet that uses some very simple lines of script (made with Tools --> Script editor inside the Sheet). The script only adds simple functionalities, e.g. to click some buttons or extract the Sheet's filename. Now, the workflow in my company is to make a copy of the main Sheet, and work in the copied version. However, when I call the script in the copied version (e.g. by clicking a button) each time an authorization request is shown. I want to avoid this request. Only 1 user needs the funcionality.
I know that this problem can be solved by publishing my script as an add-on (see How to avoid re-authorization request for a copied Google Spreadsheet + script). When publishing the script I am prompted to create a "User-managed Cloud Platform project". Tried this, but I have zero experience with cloud platform projects, OAuth, JavaScript or whatsoever.
Is there any tutorial or simple explanation available for publishing an add-on to solve this (relatively simple) problem? Or should I not even try without any experience?
Help is much appreciated!
To create a Cloud project you just have to go to https://console.developers.google.com -> click create project -> Fill the project info and click in create button [1]. The add-on can help you with your simple problem if you install the add-on for the entire domain so the add-on will be automatically installed in the Spreadsheet App without the need of the authorization request. Here you have some documentation on how to publish your add-on [2][3] and install it for domain-wide [4].
[1] https://cloud.google.com/resource-manager/docs/creating-managing-projects
[2] https://developers.google.com/gsuite/add-ons/how-tos/publishing-editor-addons
[3] https://ctrlq.org/google.apps.script/docs/add-ons/domain-wide.html
[4] https://support.google.com/a/answer/172482

Multiple copies of script in Google Apps Script

When I click on Tools -> Script Editor in a Google Doc, I am presented with the following screen, whereas before I would be directed straight to the script editor:
I am worried that there are now two instances of my script. Is there a place I can easily see and manage the scripts and projects in Google Apps Script? I have checked out Google Cloud Platform Project through the script editor menu (Resources -> Cloud Platform project), but the resulting dashboard is not very intuitive to me.
As some background: I was trying to test Google Apps Script code deployment using Clasp and after the test, I wound up with the above issue. I don't know if the issue came about when I used Clasp commands or if it was when I copied the existing document before trying out Clasp.
Thank you for taking the time to read this. Any info is appreciated.
You can bind multiple script projects to a container (the container in this case being your document).
When you have multiple projects bound to a container and you open the script editor, you are provided with a menu with a list of your projects.
You can easily delete the duplicate project. Just select it, and then when you're in the Apps Script GUI editor, navigate to File > Delete Project.
G-Suite Developer Hub
You can access all of your scripts at G-Suite Developer Hub. You can even monitor script performance from there.
Same Named Scripts
You will want to avoid scripts with the same name within a project but it's okay if they are in different projects.
Backups
If you want to make a backup of a project you can just copy it. In the case of a container app you can make a copy of the container and you will be making a copy of the scripts it contains at the same time.

Google spreadsheet: removed GS code, but afte send xhttp.open('GET request from Captivate, the Spreadsheet still run original code

thanks for helping.
I just set up google spreadsheet and GS code, Captivate JS code following :
http://elearningbrothers.com/how-to-create-a-leaderboard-elearning-google/
http://elearningbrothers.com/how-to-create-a-leaderboard-elearning-google-part-2/
This worked. But after I removed the GS code from the spreadsheet, the Spreadsheet still run original code. (I wanted to modify the code for my use, however, the spreadsheet always runs the original code. Then I removed the whole code and see what is happening.)
Thanks for helping.
Go to Script Editor in Menu > Publish > Deploy As Web Apps, select new project version and click update because Web Apps has old version of script you delete
so you need to refresh new version of your now script
More
Web Apps - Deploying Script As Web App

Deploy and use Google Sheets add-on with Google Apps Script

I'm working on a Google Sheets add-on in Google Apps Script and want to know how I can deploy it and install it into a Google Sheets spreadsheet whilst it is still in development (i.e. not ready to publish in the Store).
At the moment I'm forced to create my add-on embedded within an existing spreadsheet with no option of using it in another.
Has anyone achieved this yet?
Go to Publish>Test as Add On and Configure a New Test. Testing your script will run the code on a doc of your choosing.
You should be able to take it from there. If you're still having trouble, read on.
To setup the test, you'll need to specify which Document, Form, or Spreadsheet you want to it to run on, and save the test. Then you can run the test (from the Test as Add On popup, by clicking the Test button after you've saved your test setup) and it will execute your code on that document/spreadsheet/form by opening a new tab with that doc and executing your code.
To share the script with others (beyond making them use this same process for themselves by copy/pasting your script in their own Script Editor) you'll need to publish it to the Web Store; to do that you need to do all this stuff.
Hope that helps!
Yes its posible but first you need to be approved by google to publish.
Once you can publish you specify to publish only to a google group and not public (this is standard chrome store functionality)
I tried to do the same thing but was not able to. I just copied and pasted my code into the script manager to test with different spreadsheets.
Sorry, but I guess not.

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