google-apps-script

google-apps-script Changing column format

纵饮孤独 提交于 2020-06-27 10:02:05
问题 need to format columns c, e and a few others to show the date using the format below: 4 July 2014 Can't work out how to do it ... new to google script! 回答1: To do this using Apps script, you can use the setNumberFormat(numberFormat), which lists that date formats follow the SimpleDateFormat specification. Sample code that will do this: function formatDate(){ var ss = SpreadsheetApp.getActive(); var sheet = ss.getActiveSheet(); sheet.getRange("A2").setNumberFormat('dd MMM yyyy'); }; 来源: https:

Google Apps Script V8 assignment to null cancels debugging

。_饼干妹妹 提交于 2020-06-27 08:45:49
问题 A variable assignment to null causes debugging to cancel execution at that line. Here is a test script that reproduces the problem: function myFunction() { var a = "Hallo"; Logger.log("a=" + a); var b = null; Logger.log("b=" + b); } When debugging this script execution is cancelled on line "var b = null;". Log output is: Mar 11, 2020, 8:52:49 PM Info a=Hallo Mar 11, 2020, 8:52:54 PM Info Execution cancelled. The result is the same when stepping over the line and running past the line in debug

What is the maximum properties size in Google Apps Script?

筅森魡賤 提交于 2020-06-27 08:45:08
问题 I am trying to store large number of key/value pairs in Google Apps script and it fails after a while. I am using this: var properties = PropertiesService.getScriptProperties(); properties.setProperties(newProperties, false); It works fine until around 10,000 and then it gets this: Exception: Too many arguments provided. Expected: properties. at getGroups (GroupCache:77) at warmCache (GroupCache:133) Is this the maximum size? If so, is there a way around this? I cannot use CacheService

Google Apps Script logs (web app) don't show up in the new interface

白昼怎懂夜的黑 提交于 2020-06-27 08:30:11
问题 Apps Script has recently moved the StackDriver logs into the Apps Script dashboard, page 'Execution'. Problem is, the logs won't show up in the dashboard for Apps Script web apps. I can see the new execution line when I do a request to the Apps Script web app, but the line won't expand to show the logs. I'm using the Stackdriver Logging: function doPost(e) { console.info('my log'); } Curiously, it works when I call the dev url (Deployment column is tagged as 'Head'), the line does expend when

How to make authentication to log in a website with Google scripts?

我的梦境 提交于 2020-06-27 03:59:29
问题 I want to make an authentication and then post an ad to a website with a Google Apps Script. The plan is like this: Make an authentication to log in by HTTP post method. Get response and get cookies needed. Send a new post request with needed content of an ad and cookies to make the website identify the script as a "logged in user". I'm stuck on the 1st stage. I made this script: function sendHttpPost() { var options = { "method" : "post", "login[email]" : "mihsav76@gmail.com", "login

How do I copy & move a FORM to a folder in Google Apps Script?

微笑、不失礼 提交于 2020-06-26 16:22:15
问题 I know how to create a file into a folder (or rather move when talking about a spreadsheet, since we can not create them directly. Or can we? So my questions: 1) I created a form in my script, how do I move it to a sub folder? I've tried: var formFile = DriveApp.getFileById(form.getId()); folder.createFile(formFile.getBlob()); DriveApp.removeFile(formFile); but I received an error that I could not create a pdf file from a form. 2) Is there a way to create a spreadsheet directly into a folder?

Getting values from cells in google scripts

社会主义新天地 提交于 2020-06-26 12:06:14
问题 I am trying to make working sheets for my work. In Google scripts, I've created "Custom Menu" for my sheet wich is sending email correctly. But now I want to get value from the specific cell and check if it is below, for example, 2, send an email with that value. For now, I have this: function onOpen() { var ui = SpreadsheetApp.getUi(); // Or DocumentApp or FormApp. ui.createMenu('Custom Menu') .addItem('First item', 'menuItem1') .addSeparator() .addToUi(); } function menuItem1() {

Message blocked when sending email from Google Script

孤街醉人 提交于 2020-06-26 06:47:12
问题 I have a survey form that people submit the hours they work and it sends their response in an email to me and then CC's two other people. The script was authorized by me to send the emails and has worked fine for a long time until a couple days ago when now I am getting a reply back from all three emails saying Message blocked. Any idea why these are being blocked? MailApp.sendEmail("myemail@gmail.com",emailSubject,"", {htmlBody: body, cc: "anotheremail@gmail.com, thirdemail@gmail.com"}); If

Server error, google.script.run fails when using a shared library

亡梦爱人 提交于 2020-06-26 06:30:19
问题 I have two Google Apps Script projects, both of the Spreadsheet type. Let's call one Server and the other Client . I want to expose some functions from Server so I can call them from Client . Libraries seem perfect for this. Unfortunately when I add the Server library to Client using the Resources --> Libraries... Menu option, stuff breaks. Note, even though the Server library is added to the Client , I never actually use any Server library functions. (In fact Server Code.gs is totally blank.

Server error, google.script.run fails when using a shared library

一曲冷凌霜 提交于 2020-06-26 06:29:22
问题 I have two Google Apps Script projects, both of the Spreadsheet type. Let's call one Server and the other Client . I want to expose some functions from Server so I can call them from Client . Libraries seem perfect for this. Unfortunately when I add the Server library to Client using the Resources --> Libraries... Menu option, stuff breaks. Note, even though the Server library is added to the Client , I never actually use any Server library functions. (In fact Server Code.gs is totally blank.