google-apps-script

execute stored procedure in google apps script

假如想象 提交于 2020-06-13 09:19:12
问题 I am using the below code in google apps script to insert employee record from a Google Sheet into a mysql database. The stored procedure [dbo].[insertemployee] accepts "@empname" parameter. var empname = 'test'; var mysqldbconn = Jdbc.getConnection(url,username,password); var mysqlquery = mysqldbconn.createStatement(); callstoredprocedure = "{call [dbo].[testemployee](?)}"; mysqlquery = mysqldbconn.prepareCall(callstoredprocedure); mysqlquery.setString(1, empname); mysqlquery.executeUpdate()

Visualize Nested JSON Objects in Spreadsheet

一世执手 提交于 2020-06-13 08:33:06
问题 I'm attempting to visualize a nested JSON object in a spreadsheet – specifically Google Sheets. I'm using the Script Editor tool within my Google Sheet to write my code and the spreadsheet to output the data. I've spent about 3 solid days on this and can't figure out how to get the data to be structured properly. It starts out working correctly but quickly devolves as the code traverses further into the JSON object. I have no control over the structure of the JSON object. Because of it's size

Securely calling a Google Cloud Function via a Google Apps Script

不羁的心 提交于 2020-06-12 09:11:57
问题 How can I securely call a Google Cloud Function via a Google Apps Script? ✅ I have a Google Cloud Function, which I can access at https://MY_REGION-MY_PROJECT.cloudfunctions.net/MY_FUNCTION , and which I would like to allow certain users to invoke via an Apps Script. ✅ To secure the Cloud Function, I have set Cloud Function Invoker to only include known email (e.g. USER@COMPANY.com , where this is a valid Google email). ✅ I am able to successfully invoke the Cloud Function via curl, while

Securely calling a Google Cloud Function via a Google Apps Script

大憨熊 提交于 2020-06-12 09:11:02
问题 How can I securely call a Google Cloud Function via a Google Apps Script? ✅ I have a Google Cloud Function, which I can access at https://MY_REGION-MY_PROJECT.cloudfunctions.net/MY_FUNCTION , and which I would like to allow certain users to invoke via an Apps Script. ✅ To secure the Cloud Function, I have set Cloud Function Invoker to only include known email (e.g. USER@COMPANY.com , where this is a valid Google email). ✅ I am able to successfully invoke the Cloud Function via curl, while

Autosize Spreadsheet Columns

て烟熏妆下的殇ゞ 提交于 2020-06-12 02:55:53
问题 I didn't see anything in the documentation that would make me think this is a supported function. I'm writing to several sheets and visually it's difficult to see all the data without highlighting all the columns and autosizing with my mouse. I'd rather not have to do that everytime I run my script. Is there a way to do this programmatically with app scripts? I saw the option to setColumnWidth, but how do I know how wide to set my columns when my text could vary from column to column. =

How to make all sheets of a Google spreadsheet show A1 in upper left?

蹲街弑〆低调 提交于 2020-06-11 13:10:46
问题 I have a 72 sheet Google spreadsheet and am trying to reset each sheet so that it shows A1 in the upper left when you click on its tab. That is, if a sheet is scrolled downward so that you can't see A1, I want it to scroll back so that you can. I've tried the following google scripts, but nothing does the job. I got the 4th one (reset4) from here but that didn't work either. function reset1() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var allSheets = ss.getSheets(); for (var i = 1; i <

Google UI App Scripts: Create a Google Doc with a legal paper size and landscape layout

佐手、 提交于 2020-06-11 05:48:18
问题 Using Google UI App Scripts how can you create a new Google Doc with a legal paper size and landscape layout? From the Document Service page I see how you can create a new document and edit a lot of the elements but not the page size or layout orientation. Am I missing it? Or is this something that is not possible? 回答1: Paper size of the document can be set using setPageHeight and setPageWidth methods of the class Body function setPageSize(){ var doc = DocumentApp.create("file name"); var

Can a Google Spreadsheet Apps Script library contain a user dialog?

核能气质少年 提交于 2020-06-11 05:43:12
问题 Are there restrictions on what may be in an Apps Script library to be used by Google Spreadsheets? Specifically, can a library include an HTML dialog? I've created a spreadsheet script that adds a menu item to present the user with a dialog box. It uses HtmlService.createHtmlOutputFromFile('mappingForm').setSandboxMode(HtmlService.SandboxMode.IFRAME) as described in https://developers.google.com/apps-script/guides/html/communication. The HTML file includes HTML, CSS and JavaScript with jQuery

google script use html service in gmail addon

心不动则不痛 提交于 2020-06-10 02:10:29
问题 I've try to create simple form in gmail addon, how to use html service The below code,i have tried, function buildAddOn(e) { var accessToken = e.messageMetadata.accessToken; GmailApp.setCurrentMessageAccessToken(accessToken); var test_card = doGet() cards.push(test_card); return cards; } function doGet() { return HtmlService.createHtmlOutput('<b>Hello, world!</b>'); } Thanks in advance 回答1: I understood that you want to use HTML at Gmail add-on. If my understanding is correct, how about these

Take mail ID by pressing a button in googlesheet

僤鯓⒐⒋嵵緔 提交于 2020-06-09 05:38:10
问题 Can someone suggest me a Google Script that will make a button that will get the mail ID of the person and put it into a specified Google sheet. 回答1: This would be your script. Create a drawing like a button, via the little 3 dots you can assign it to a script, type: getEmail. If the user is a gmail user it will append the value to the target sheet. If not then it opens a prompt where someone can enter the email. function getEmail(){ const ui = SpreadsheetApp.getUi(); const ss =