google-apps-script

Google Apps Script Custom Menu / createMenu not displaying in Slide when presentation opens

旧城冷巷雨未停 提交于 2021-02-11 14:41:48
问题 Does createMenu work differently for slides than it does for spreadsheets? Is this a bug or is something wrong with my code? Should it be reported? SIMPLE TEST - - - - - - - DOES NOT CREATE MENU ON OPEN FROM DRIVE OR REFRESH function onOpen() { console.log('In onOpen' ); const pres = SlidesApp.getActivePresentation(); const slideSet = pres.getSlides(); let ui; try { ui = SlidesApp.getUi(); console.log('getUi succeeded' ); } catch (e) { console.log('caught in getUi: ', e ); } try { ui

How to execute Data Transfer API?

陌路散爱 提交于 2021-02-11 14:21:49
问题 I have few accounts where I need to transfer the ownership to another account. I have the list listed in google sheets with all the email addresses. I am using the code below to hopefully execute it but I am not sure what to use to execute the code. I appreciate your time and help! TIA! function dataTransfer() { var ss = SpreadsheetApp.openById("SHEETID") var sheet = ss.getSheetByName("SHEETNAME"); var start = 2; var end = sheet.getLastRow(); var range = sheet.getRange(start,1,end,sheet

Time Zone in script is and in Google Sheets is different than Google Calendar

空扰寡人 提交于 2021-02-11 14:21:36
问题 I am putting the time zone in as GMT, which matches my calendar settings. However, when the dates and times export into Google Sheets it is coming up an hour prior to the times that are listed on the calendar. Please help to determine what is going wrong. This is my code I am pulling from my calendar of events: var events = cal.getEvents(new Date("October 2, 2018 00:00:00 GMT"), new Date("October 8, 2018 23:59:59 GMT"), {search: '-project123'}); The time in the calendar states 9:25 GMT but

How to execute Data Transfer API?

…衆ロ難τιáo~ 提交于 2021-02-11 14:20:38
问题 I have few accounts where I need to transfer the ownership to another account. I have the list listed in google sheets with all the email addresses. I am using the code below to hopefully execute it but I am not sure what to use to execute the code. I appreciate your time and help! TIA! function dataTransfer() { var ss = SpreadsheetApp.openById("SHEETID") var sheet = ss.getSheetByName("SHEETNAME"); var start = 2; var end = sheet.getLastRow(); var range = sheet.getRange(start,1,end,sheet

GAS triggers randomly disabling after being created programmatically

被刻印的时光 ゝ 提交于 2021-02-11 14:00:39
问题 I have created a few trigger chains that fire at specific times over a weekend. I have chained them due to the limit of 20 timed triggers available to me. Randomly a newly created trigger on the chain will become disabled and therefore not run. Obviously this ruins the entire chain and completely messes up what I'm trying to achieve. I thought there may have been an issue in the ordering of exactly when I created the new trigger in the code, but this doesn't seem to be the case. I'm wondering

How do I send an email in google apps script with basic text formatting?

久未见 提交于 2021-02-11 14:00:38
问题 I have an apps script to automate some emails and want to send a body from a template. I figured I could store the template as a google doc, fetch it, and send it in the script. I have something like this: var doc = DocumentApp.openById("DocumentID"); MailApp.sendEmail("toEmail", "fromEmail", "TPS report status", doc.getBody().getText()); This does work, except that the email body has new lines inserted in seemingly random areas, although it does retain the new paragraphs that were part of

How do I send an email in google apps script with basic text formatting?

假如想象 提交于 2021-02-11 13:57:05
问题 I have an apps script to automate some emails and want to send a body from a template. I figured I could store the template as a google doc, fetch it, and send it in the script. I have something like this: var doc = DocumentApp.openById("DocumentID"); MailApp.sendEmail("toEmail", "fromEmail", "TPS report status", doc.getBody().getText()); This does work, except that the email body has new lines inserted in seemingly random areas, although it does retain the new paragraphs that were part of

In Google Sheets how can I write a script to move each drawing to a specific location on the sheet?

南笙酒味 提交于 2021-02-11 13:52:48
问题 I have a Google sheet with four drawings i.e. shapes. What script would move each shape to a designated location on the sheet? Here is a link to an example where I'd like to click on the blue rectangle and have the script move the green rectangle to cover cell A1, the purple triangle to cell D7, and the orange circle to cell I3. https://drive.google.com/open?id=1eFCwDiY90ZM5SIMa6C0rSdhG_oC-SWgsk8vAvjIR34s I can't find a way to select specific drawings. 回答1: I believe your goal as follows. You

How do I get the managers/contributors/etc of a Google Team Drive?

被刻印的时光 ゝ 提交于 2021-02-11 13:47:42
问题 Team Drive has five permission levels: Manager Content Manager Contributor Commenter Viewer The Folder API, on the other hand, only has three functions for getting a user list of people on a folder: getEditors() getOwner() getViewers() This works fine if you're using a My Drive, because it has those exact same three levels: Is Owner Can organize, add, & edit Can view only How do I get each of the 5 access levels in a Google Team Drive? If I do call those 3 functions, which access level do

Unexpected output using reduce to create json

 ̄綄美尐妖づ 提交于 2021-02-11 13:41:48
问题 I'm working with apps script. I have an array of objects 'sendableRows' that I would like to turn to json and email. an object looks like: [{Phone Number=14444444444, Eagerness=High, Index=4816.0, completed=, Lot Size=0.74, Power or water=, campaign=, absoluteRow=84.0}] my code: const json = sendableRows.reduce(row => JSON.stringify(row), "") Logger.log(json); MailApp.sendEmail({ to: 'xxxx@gmail.com', subject: todayString, htmlBody: json }); unfortunately 'json' is being output as: [20-07-26