Want to go to a particular folder in gmail inbox - gmail-addons

I am developing a gmail addon. I want after a process is completed on addon I should redirect the user to a particular folder. I am now using setOpenLink but it opens in a new window. I want it to open in same window similar to when we click on any folder.
Can you anyone help?

Related

How to open Google Forms on Google Sheets

I'm creating a simple vehicle monitoring system using Google Sheets. I have drawn a shape to be used as a button, and I've assigned a script to it.
Here's the script I'm trying to run:
function newlto() {
var form
=FormApp.openById('1kJLfksSYgOv6Q0UGjdnklg2E5J5R03mIUHoefIvuZ28');
}
The script is supposed to open my Google Form, however, the script runs no problem but it does not open the form, after the "Finished running script" notification at the top-center, nothing happens.
You are trying to open a Google Form from a script. Google Apps Script will not automatically open web pages, and a Google Form is a web page - so you can't write a script to open a form.
You may find it easier to create a simple hyperlink to the Google Form.
The steps to do this (assuming that you have access to the form editor):
Send Form
click "Send",
at the top of the screen where it says "Send via", click the middle icon for the link,
click the link ( or a variation here is to click the "Shorten URL" box to get, well, a shorter URL),
click "Copy" (to put a copy of the link into memory,
switch to your spreadsheet and paste the link into a cell.
This automatically creates a hyperlink.
To access the URL, hover you have to hover the hyperlink, and then click the popup box that appears.
You would probably benefit from reading these topics which cover issues sim
You should read:
google spreadsheet - open external URL from button (created 2018),
Google Apps Script to open a URL (created 2012),
Google App Scripts Function to Open URL (created 2018).
I guess you want to open the form using a button, using something like window.open(); the problem is that Apps Script is server scripting and this method cannot be called from a server script but with a client script. If you try to use it it will prompts an error message indicating that window is not defined.
when you use FormApp.openById(); you are opening the form on the server to work on the Form by using the script, is like doing the same steps manually on the browser but with coding on the server. You can find more information on the Apps Script - Forms website.

How to give access for review Google App Script web page?

I'm create Google App script web page and i share link with my friends. that request access for view page. I received this mail for my friend.
However i cannot give permission for friend. after press "Open sharing settings" it open my script but there hasn't any changes.
This can be reason of Google drive Access problem,
This can be reason of Google Sheet Access problem,
This can be reason of G Mail authentication problem,

Menu is automatically disabled in Google Spredsheet & unable to open html service popup

I've one project in which Google spreadsheet is used. In Google Spreadsheet I've created a custom menu using Google App Script which consists of sub menu in it. After clicking on particular menu one html service popup appears. The same spreadsheet is shared among some email ids. Some worksheets in the spreadsheet are shared with view permission to some users.
From last 2 days, for one of the email id menu got disabled automatically and even after clicking on the menu html service popup didn't appear. Same functionality is working fine for other users who have edit permission.
There is as such no co-relation between the code and permission of user because same code as well as functionality was working fine from last 3 months.
Any suggestion for the same.
Only users who have permission to edit a spreadsheet, document, or form can run its bound script. Collaborators who have only view access cannot open the script editor, although if they make a copy of the parent file, they become the owner of the copy and will be able to see and run a copy of the script.
Ref: Scripts Bound to Google Sheets, Docs, or Forms
I experienced a similar problem where a custom menu that I created wasn't displayed when I was on someone else's computer. Clicking on the menu item to open the script editor didn't work either (no new tab was opening). I was in Firefox, I opened it in Chrome and it worked.

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

Delay the Authorization Dialog with GAS Ui Service

Is there a way to delay the Authorization Dialog in a stand alone Google Apps Script?
I have a public script that needs to be granted several permissions from the active Google user. I want to tell the user how the script works before asking for all those permissions.
It is not obvious why I need access to all the services, so this dialog looks scary :
https://developers.google.com/apps-script/scripts_google_accounts#grantingAccess
My script is a "web app' with the UI Service so the first thing to be displayed comes from doGet(), but the permission dialog opens first. Isn't there a way to delay the dialog until the permission is actually needed ?
One possible way would be to call the script from a dedicated website I suppose, but that's not simple.
One workaround is to have two web apps:
The first is an 'intro' web app that runs using your account, so it doesn't prompt the user.
Then, you redirect them to a second web app that runs using their account, which will prompt them.