google-apps-script

Get the first hyperlink and its text value

一笑奈何 提交于 2021-01-29 18:49:02
问题 I hope everyone is in good health health and condition. Recently, I have been working on Google Docs hyperlinks using app scripts and learning along the way. I was trying to get all hyperlink and edit them and for that I found an amazing code from this post. I have read the code multiple times and now I have a good understanding of how it works. My confusion My confusion is the recursive process happening in this code, although I am familiar with the concept of Recursive functions but when I

google docs linked charts refresh with api or apps script

寵の児 提交于 2021-01-29 18:23:37
问题 I have a google doc that I show inside an iframe in my website for public editing , it contains linked charts from a public spreadsheet, I change the chart data with spreadsheet api, but the chart in the doc does not refresh automatically, and I can't clic update or update all in the doc because the " update button " is disabled, SO I wanted to use google docs api or apps script to refresh charts, I did not find how to do it with google docs api , and apps script does not trigger inside the

Autocopy cell value from one cell to another sheet by clicking an icon in google sheets

社会主义新天地 提交于 2021-01-29 17:40:00
问题 I would like to copy cell value from cell A2 to a new spreadsheet by clicking on an icon in C2. Preferable I would like to add a timestamp to my new spreadsheet when someone clicks on C2. Could someone help me out with this matter? I have made a test spreadsheet here: https://docs.google.com/spreadsheets/d/1SUqqwr2fGZTDFMyCw9WRWUljSoHUO05X_a0arqLPUdo/edit#gid=0 The icon should be clickable by an anonymous user not only by the editor of the sheet. Any help is much appreciated 回答1: I posted the

MailApp.sendEmail bcc not shown in sent items

吃可爱长大的小学妹 提交于 2021-01-29 17:09:57
问题 I am using the following to send to a mailing list, where: receipient = email,email,email... MailApp.sendEmail('', MailTitle, '', {name:"mysenderalias", inlineImages:{logo:image},htmlBody:body,bcc:receipient,cc:'info@mydomain'}); I know the mail was sent after verifying with few of the receipients. Problem is I do not see the bcc list in the sent items of the gmail account Ideas anyone? 来源: https://stackoverflow.com/questions/60320477/mailapp-sendemail-bcc-not-shown-in-sent-items

google spreadsheet add custom menu to list sheets

孤人 提交于 2021-01-29 16:52:24
问题 I have a google spreadsheet which contains a lot of sheets. It's uncomfortable to go to a sheet that I want. So I want to make a custom menu that list my sheets. Is there an easy way to make this? (using google apps script..?) 回答1: I believe your goal as follows. You want to move the sheet by selecting the sheet at the custom menu on Google Spreadsheet. For this, how about this answer? In this answer, I would like to propose a sample script for achieving your goal by modifying this answer.

Fill a cell with timestamp of another cell edit ONLY if another cell is not blank

限于喜欢 提交于 2021-01-29 16:28:21
问题 I need fill a cell in google spreedsheet with the timestamp of the another cell's edition. But this timestamp should be show only if the another cell is edited with some content, not with erase the cell. I have been try with this code, but the timestamp is shown also if i erase the another cell. function onEdit(e) { if ([8].indexOf(e.range.columnStart) != -1) { if ([8].indexOf(e.range.columnStart) === '') { e.range.offset(0, -7).setValue('0'); } else e.range.offset(0, -7).setValue(new Date())

Install trigger for google app script in custom addon

那年仲夏 提交于 2021-01-29 16:19:13
问题 I am still very new to addons and I am having trouble to install triggers and have the related functions to run. Below is the function to add 1 "on open" trigger and 1 "on edit" trigger to the sheet. function addTriggers() { var sheet = SpreadsheetApp.getActiveSheet(); var triggers = ScriptApp.getUserTriggers(sheet); if(triggers.length!=2)// { ScriptApp.newTrigger('sheetOpen') .forSpreadsheet(sheet) .onEdit() .create(); ScriptApp.newTrigger('sheetEdited') .forSpreadsheet(sheet) .onOpen()

Google Apps Script Calendar Service: How to store and retrieve CalendarEvents using PropertiesService?

空扰寡人 提交于 2021-01-29 15:45:58
问题 I'm referring to this question. As this code var cal = CalendarApp.getCalendarById("Calendar Id"); var startTime = new Date(1850, 0, 1); var endTime = new Date(2100, 0, 1); var events = cal.getEvents(startTime, endTime); Logger.log(events); var sp = PropertiesService.getScriptProperties(); sp.setProperty("events", JSON.stringify(events)); events = JSON.parse(sp.getProperty("events")); Logger.log(events); returns: Info [CalendarEvent, CalendarEvent, CalendarEvent, CalendarEvent, CalendarEvent]

How to reference a cell as the file or folder id for DriveApp?

我与影子孤独终老i 提交于 2021-01-29 15:36:37
问题 I have an app script function that includes IDs for both a doc file tmplate and a Google Drive folder location. I want the ID to be dynamic based on a users input via a cell reference in a Google Sheet. Is it possible to call this value using a cell reference? Example: Settings!B9 = Google Doc Template ID //This value should be the id of your document template that we created in the last step const googleDocTemplate = DriveApp.getFileById('INSERT CELL REFERENCE'); //This value should be the

Take values ​from one sheet and save them on the other sheet based on the ID

﹥>﹥吖頭↗ 提交于 2021-01-29 15:34:11
问题 I tried to create a script that takes values ​​from one sheet and saves them on the other sheet based on the ID. Unfortunately, the script only saves the first value. What's wrong? function script1() { // get first sheet var Kwoty = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Kwoty"); var FirstRow = 10; var LastRow = Kwoty.getLastRow(); var RowRange = LastRow - FirstRow + 1; var WholeRange = Kwoty.getRange(FirstRow,6,RowRange,8); var AllValues = WholeRange.getValues(); //Logger.log