google-apps-script

Google Apps Script - Pass Anonymous Function To Menu.addItem

青春壹個敷衍的年華 提交于 2021-02-19 06:05:25
问题 I am building a container bound google apps script for a school. The school requires every written item to have the 'school heading'. The school uses blocks A-G as periods. My goal is that there will be a menu, 'School Heading', when opened it has the submenus 'A Block', 'B Block', 'C Block', and in each submenu there will be an option for each class, which will insert the heading for that class into the document's heading Here is my code: var BLOCKS = "abcdefg"; var CLASSES = ["English",

Insert Emoji unicode from google sheets to an email using script editor

冷暖自知 提交于 2021-02-19 06:04:41
问题 I'm trying to get some text out of google sheets using the script editor to send an email. The text contains an emoji unicode, however, when the email is sent it prints the plain text instead of displaying the unicode emoji.\ What I'm seeing in the email: &#9889 some text here &#9889 What I'd like to see in the email: '⚡ some text here ⚡' The text I have saved within google sheets: ⚡ some text here ⚡ The script I use to get the text out of google sheets. var emailText = myTemplate.getRange(x,

Insert Emoji unicode from google sheets to an email using script editor

家住魔仙堡 提交于 2021-02-19 06:04:00
问题 I'm trying to get some text out of google sheets using the script editor to send an email. The text contains an emoji unicode, however, when the email is sent it prints the plain text instead of displaying the unicode emoji.\ What I'm seeing in the email: &#9889 some text here &#9889 What I'd like to see in the email: '⚡ some text here ⚡' The text I have saved within google sheets: ⚡ some text here ⚡ The script I use to get the text out of google sheets. var emailText = myTemplate.getRange(x,

Adding “password” type to Google Apps Script inputBox

北战南征 提交于 2021-02-19 04:36:05
问题 Is it possible to assign the "password" type to the Google Apps Script inputBox so the text doesn't show? The following is working just fine, but the input field is a simple textbox and displays the text rather than "••••••••": Browser.inputBox('Please enter your password'); I have a Google Sheet with an associated script that automatically populates some cells with information retrieved from an external API. The API requires simple authentication so that's why I'm prompting the user for

How can I delete container-bound scripts from multiple Google Documents or Sheets simultaneously without deleting the containers/files?

荒凉一梦 提交于 2021-02-19 02:21:30
问题 I created a container-bound script inside of a Google Document. Since then, I created a stand-alone script to replace this container-bound script, but I never deleted the initial container-bound project from the original document. The new stand-alone script makes a copy of the original document using it as a template for a new document. Because I forgot to delete the initial project from the original document, a copy of the script was also made each time. I now have an extremely large number

Google Apps Script, JDBC and MySQL does not work with Date 0000-00-00

别等时光非礼了梦想. 提交于 2021-02-18 19:09:50
问题 I am trying to read a MySQL db record using this simple code in Google Apps Script: function testConn(){ // make the connection var connection = Jdbc.getConnection("jdbc:mysql://" + DB.URL + ":" + DB.PORT + "/" + DB.DATABASE, DB.USERNAME, DB.PASSWORD); // perform the query var SQLstatement = connection.createStatement(); var result = SQLstatement.executeQuery("SELECT date_available FROM oc_product where model = 'B23-U57-U57'"); var colNum = result.getMetaData().getColumnCount(); while(result

Google Apps Script, JDBC and MySQL does not work with Date 0000-00-00

心已入冬 提交于 2021-02-18 19:03:08
问题 I am trying to read a MySQL db record using this simple code in Google Apps Script: function testConn(){ // make the connection var connection = Jdbc.getConnection("jdbc:mysql://" + DB.URL + ":" + DB.PORT + "/" + DB.DATABASE, DB.USERNAME, DB.PASSWORD); // perform the query var SQLstatement = connection.createStatement(); var result = SQLstatement.executeQuery("SELECT date_available FROM oc_product where model = 'B23-U57-U57'"); var colNum = result.getMetaData().getColumnCount(); while(result

How do you post form submissions to a Google Drive Spreadsheet using Google App Scripts

醉酒当歌 提交于 2021-02-18 19:01:06
问题 I want to create a form on my site that when a user submits, it posts their data to a particular Spreadsheet in my Google Drive. How can I do this with Google App Scripts? sample form <form method='post' action='https://script.google.com/macros/s/xxxx.....'> Favorite Color <input type='text' value='' name='color' /> Favorite Ice Cream Flavor <input type='text' value='' name='flavor' /> <input type='button' value='submit' /> </form> so that when I hit submit it creates a record in a Google

Facebook Graph API not working on UrlFetchApp

不想你离开。 提交于 2021-02-18 19:00:53
问题 I run a query on Facebook Graph API Explorer successfully but when I run the same query on Google Apps Script with UrlFetchApp I get an Error - Invalid argument . The query is this: https: //graph.facebook.com/v4.0/act_1015703131******/insights?fields=spend&level=account&date_preset=yesterday&filtering=[{field:campaign.name,operator:CONTAIN,value:perf},{field:adset.name,operator:NOT_CONTAIN,value:rmk}]&access_token=******** When I run the same query without filtering it works as expected!

Determining the last row in a range of columns that contain empty cells - Google Sheets

我的梦境 提交于 2021-02-18 18:56:29
问题 I'm having trouble creating a function to find the last row with data in a specified range, in this case I have data that moves in columns A:K and functions that use that data in L:Z . I want to paste data in the first empty row in the range A:K . I have tried using the solution of finding the first empty row in a specific column: var Avals = ss.getRange("A1:A").getValues(); var Alast = Avals.filter(String).length; but that isn't a viable solution for me since we may have empty first values