google-apps-script

Is there a script to empty Google Team Drive Trash Related Folders?

痴心易碎 提交于 2020-04-18 06:40:21
问题 How can I make a script to empty the google team drive trash folder? If I have three main folders in google drive, it makes three main trash folders. How can I empty all those folders? All the scripts that I found only manage to empty the my drive trash folder. I have already tried a lot of scripts as you can see the codes below function createTimeDrivenTriggers() { ScriptApp.newTrigger('emptyThrash') .timeBased() .everyMinutes(1) .create(); } function emptyThrash() { Drive.Files.emptyTrash()

Validate phonenumbers to specific format using Google Sheet formula

梦想的初衷 提交于 2020-04-18 05:43:27
问题 I'm working with google sheets and would like to convert US phone numbers to the format: 1xxxyyyzzzz eg 402-333-4444 should be turned into 14023334444 I have an apps script validator function which does this: var numbers = 'INVALID' if ( parsed_body.hasOwnProperty('PHONE') ) { var phone = parsed_body['PHONE'].toString(); Logger.log(parsed_body); numbers = phone.replace(/[^0-9]/g, ""); var firstChar = numbers.charAt(0); if ( firstChar !== '1'){ numbers = '1'+ numbers} Logger.log(numbers); if (

How to dynamically change an existing text item value on Google Forms using Google Apps Script

折月煮酒 提交于 2020-04-18 05:40:30
问题 I have an existing Google Form in which there is a TextItem with a title "Which location was this performed at?". Whenever the form is loaded (opened), I need to set a location value (loc) to this existing textbox and show it to the user. function populateMemberIds(loc){ var form = FormApp.openById(formUrl); var questions = form.getItems(); for (var i=0; i<questions.length; i++){ if(questions[i].getTitle()=="Which location was this performed at?"){ var textItem = questions[i].asTextItem(); /

Compare sheet 1 to sheet 2 and output to sheet 3. Google sheets. JavaScript

笑着哭i 提交于 2020-04-18 00:54:54
问题 The following code works successfully to compare column A of sheet 2 with Column B of sheet 1, any matches will copy the entire row to sheet 3. However im needing a very slight change of this code that compares column A of sheet 2 to column N of sheet 1 instead of column B. Could someone help me with this code change? Here is the link to the previous post Java script optimization for a google apps script function copyRowtoSheet3() { var spreadsheetId =

Compare sheet 1 to sheet 2 and output to sheet 3. Google sheets. JavaScript

纵然是瞬间 提交于 2020-04-18 00:52:38
问题 The following code works successfully to compare column A of sheet 2 with Column B of sheet 1, any matches will copy the entire row to sheet 3. However im needing a very slight change of this code that compares column A of sheet 2 to column N of sheet 1 instead of column B. Could someone help me with this code change? Here is the link to the previous post Java script optimization for a google apps script function copyRowtoSheet3() { var spreadsheetId =

Can't get menu item to show in an unpublished add-on for google document

落花浮王杯 提交于 2020-04-17 22:54:29
问题 My code look like that: function onInstall(e) { onOpen(e); } function onOpen(e) { DocumentApp.getUi().createAddonMenu() .addItem("Format Your Text", "autoFormatting") .addToUi(); } function autoFormatting() { //some code } I have set a project in Google Cloud Platform and linked in to my Google Apps Script unbound project. Enabled the G Suit Marketplace SDK and configured it. The version is the correct one. When I test the script as add-on in any state (installed/enabled/both) the menu item

How to get an array of data in google sheets based on date in column?

一个人想着一个人 提交于 2020-04-17 22:13:11
问题 I'm trying to pull sub-section of data from one google sheet to another each day. The pull is conditional based on date which is why I am struggling. Context - I have 'Workbook 1' that logs price data each day for different NBA teams. The data is captured and added to the bottom of the table each day (so the most current price data is at the bottom). It is date-stamped in column K with =today().. header is "Pull Date". I have a separate workbook we'll call 'Workbook 2' for the NBA in which I

How to get an array of data in google sheets based on date in column?

99封情书 提交于 2020-04-17 22:12:47
问题 I'm trying to pull sub-section of data from one google sheet to another each day. The pull is conditional based on date which is why I am struggling. Context - I have 'Workbook 1' that logs price data each day for different NBA teams. The data is captured and added to the bottom of the table each day (so the most current price data is at the bottom). It is date-stamped in column K with =today().. header is "Pull Date". I have a separate workbook we'll call 'Workbook 2' for the NBA in which I

Looking for a way to add borders to a paragraph in a google doc using a Google Apps Script or perhaps the DOCS API?

余生颓废 提交于 2020-04-17 22:09:29
问题 It is possible to add a border to a google doc paragraph via the Format menu > Paragraph styles > Borders and shading . The result looks like this: However, I have not managed to work out how to do this using Google Apps Scripts? I have consulted the documentation concerning setting attributes, however, borders do no appear. It seems it is possible to set them using sheets and slides - but that isn't the use-case I am after. I used the DOCS API via node.js to download the sample JSON returned

Set Permission for getEmail to Work for Users on Same G Suite Domain

别来无恙 提交于 2020-04-17 21:43:24
问题 I have a simple script that gets the user email and date/time when a cell is edited on a google sheet. This script works when I run it; however, when a user in my G Suite domain runs the script it returns a blank email. I have searched a bit about this and know that this occurs when triggered by onEdit but was under the impression that it would work if authorized by the script creator when all users are in the same G Suite Domain. Here is an example of the code that I am running: function