How to Publish/Deploy Google Sheet script as API executable programmatically? [duplicate] - google-apps-script

This question already has answers here:
Can I deploy bound scripts using Google Script API
(2 answers)
Closed 2 months ago.
I have a google sheet containing script, I want to perform following operations programmatically.
Make this Google spreadsheet public programmatically.
I want to execute the script associated with the above spreadsheet programmatically for any user (public).
Can I perform "Publish>Deploy as API executable" programmatically?

You may want to check the recent updates in Release Notes and see if it will help. It's stated:
You can now deploy a script project directly from the project manifest.
We've updated the Publish script editor menu item to more accurately represent the various kinds of deployments a project can have, such as add-on, web app, or API executable deployments.
For more information, you may want to check these references:
Using the Execution API
Publishing an Add-on
Then, for features not currently supported, you may check or file a feature request here.

Related

How to launch Google App Script from external [duplicate]

This question already has answers here:
Can not run trivial app script bound to new blank document - get "This app is blocked"
(3 answers)
Closed 5 months ago.
I have created a custom function in a Google Sheet and I have given access to the Sheet to other users. But unfortunately the security settings of there company do not allow the users to unlock this script for their account.
This app is blocked. This app has tried to access confidential data in your Google account. To protect your account, we have blocked the access.
Is there any way that users can still run this script externally without having to install it themselves? So for example via a click on a button, which then starts the script in my account.
No, you won't be able to do that. The only way some code could be triggered by external users, but effectively executed by your account, would be in an apps script web app.
As you can see in the screenshot, there's an "Execute as" setting when you deploy an app that controls this behaviour:
I appreciate that this may not be an option for you, given that the current code is a custom function in a sheet. The only other approach would be to have the external users make a copy of the sheet, with its function(s), to run in their Google Workspace environment.

Unable to connect Google forms to Firebase Realtime Database [duplicate]

This question already has an answer here:
Cannot add Firebase library to Apps Script
(1 answer)
Closed 1 year ago.
I am working on an add-on that will send the questions and answer from the google forms to the real-time database. I found the following steps to be able to pass the forms data to firebase.
However, when following the steps, I get the following error (refer to the screenshot below). I am not sure if this library is no longer available. Is there another approach that I can try that will allow me to pass the data from google forms to firebase?
According to this post: Cannot add Firebase library to Apps Script:
You now need the script ID as opposed to the project key to install an Apps Script library. The script ID for this specific library is 1hguuh4Zx72XVC1Zldm_vTtcUUKUA6iBUOoGnJUWLfqDWx5WlOJHqYkrt, which can also be seen in the FirebaseApp site.
References:
Libraries
Firebase

How to capture google account of viewer using google apps script? [duplicate]

This question already has an answer here:
Getting a list of active file viewers with apps script
(1 answer)
Closed 1 year ago.
So i have a google sheet table to store data of my team (name and gmail account). I will assign every user with different task in my project. I create a web app (user interface) using apps script so my user can interact with the task. In this case, assumes all my users will be using google chrome browser and need to login to the google account on their own browser. For users who use other browser or if not sign in to google account will be ignored.
If i deploy my apps script, is there any method to know which user is browsing it just by checking the google account they use. I don't want to create custom user/pass to login. I just want the script can detect by active google account to personalize the page so they don't need to see all available the task but only can see specific task that they are assigned to.
https://stackoverflow.com/a/66342797/16125139
This should help you
Session.getActiveUser().getEmail()

SF Connector with Apps Script [duplicate]

This question already has an answer here:
GAS: Calling functions defined in an add-on from bound script?
(1 answer)
Closed 2 years ago.
I have connected my gsheet to SF using the Data connector for Salesforce and have imported a report.
Is there a way to refresh this report using Apps Script? Or even import another report?
The Data connector for Salesforce has an option to automatically refresh the data in your sheets (see image below). I think this answers what you're looking for.
Salesforce data connector
If you want to build sales tools in a spreadsheet (find leads, automate reporting, etc) you might want to check rows.com . We combine a spreadsheet editor with built-in integrations and automation (Salesforce, Linkedin, Crunchbase, ...), all using formulas, without code.
Here's our integration with Salesforce
https://rows.com/integrations/salesforce

AppScript and Access in Sheets [duplicate]

This question already has answers here:
How to protect the Apps Script code in a Google spreadsheet?
(6 answers)
Closed 5 years ago.
Can I open access to the sheets for editing, with the ability to run scripts. But do not give access to viewing and editing scripts?
Or how can I give users access to run scripts without changing them?
Yes, this is easily done. However, from experience, ensure you extensively test your scripts and add all the necessary error handling before distributing it.
Basically, what you need to do it create a new standalone script file, save a version and then distribute the project key to your users or if you are creating a template that the user will make a copy of then call the functions in the script editor of the template file.
Google Documentation on creating librarys
Google Documentation on creating a version