google-apps-script

How do I restrict a trigger to a specific sheet/tab?

*爱你&永不变心* 提交于 2020-08-25 07:55:38
问题 I have written a script in google sheets that will change the time stamp in the selected cell anytime the entire spreadsheet is updated at all. However, I need the timestamp to only update when one single sheet(tab) is updated. Here is my current function: function onEdit() { var sheetActive = SpreadsheetApp.getActiveSpreadsheet() .getSheetByName("Board") .getRange('A28') .setValue(new Date()); } The name of the sheet(tab) that I want to check for an update in is "Input" and the specific cell

Google Apps Script: Downloading files from Drive (same user)

匆匆过客 提交于 2020-08-24 10:22:44
问题 I'm trying to write a Google Apps Script to download all files in a particular Drive folder (likely .csv files). I have found the getDownloadUrl() method but I haven't been able to figure out what to do with it. I'm currently trying the following code, where files is the list of the files in the folder: while(files.hasNext()) { var response = UrlFetchApp.fetch(files.next().getDownloadUrl()); Logger.log(response.getContentText()); } When I try to run the code, however, I get a 401 error which

Set Date/Time to 00:00:00

自闭症网瘾萝莉.ら 提交于 2020-08-24 06:13:03
问题 I have an array of dates with different times in the date. Example: {4/15/13 05:00:00, 03/10/13 13:00:00, 02/10/13 02:00:00, etc.} If I wanted to change just the hour to 00:00:00 so the array would read: {4/15/13 00:00:00, 03/10/13 00:00:00, 02/10/13 00:00:00, etc.} How would I do that? I've tried using getTime(), but I don't have control over just the hours. Any help would be great. Thanks! EDIT: I tried this loop: for (var i = 0; i < gValues.length; i++) { // repeat loop sheet.getRange(i +

Set Date/Time to 00:00:00

一个人想着一个人 提交于 2020-08-24 06:12:08
问题 I have an array of dates with different times in the date. Example: {4/15/13 05:00:00, 03/10/13 13:00:00, 02/10/13 02:00:00, etc.} If I wanted to change just the hour to 00:00:00 so the array would read: {4/15/13 00:00:00, 03/10/13 00:00:00, 02/10/13 00:00:00, etc.} How would I do that? I've tried using getTime(), but I don't have control over just the hours. Any help would be great. Thanks! EDIT: I tried this loop: for (var i = 0; i < gValues.length; i++) { // repeat loop sheet.getRange(i +

Alternative to calling gapi.auth.authorize every time

此生再无相见时 提交于 2020-08-24 03:31:59
问题 I have a single-page web application that uses Google Apps Script Execution API to call functions that return the data I need. I based my project on the quick start sample code provided by Google. This requires the use of OAuth and I am accomplishing that via functions that make use of the client JavaScript library provided by Google. The first time a user is asked to authenticate the following function is used with immediate: false : gapi.auth.authorize({client_id: CLIENT_ID, scope: SCOPES,

“Reference does not exist” error when executing a custom function

五迷三道 提交于 2020-08-24 03:29:26
问题 I am writing a function in Google Apps Script and it seems the last error I need to get around is a "reference does not exist" error in Google Sheets when I call my function. I don't know what to do about this because it doesn't seem to be a problem with my code. This is what my code looks like now. It isn't complete because I need to change it for user input, but this is a test. In a google sheets cell I type in =sortingtesting() function sortingtesting() { var pInfo1 = ['a','b','c','d','e',

“Reference does not exist” error when executing a custom function

时光怂恿深爱的人放手 提交于 2020-08-24 03:28:51
问题 I am writing a function in Google Apps Script and it seems the last error I need to get around is a "reference does not exist" error in Google Sheets when I call my function. I don't know what to do about this because it doesn't seem to be a problem with my code. This is what my code looks like now. It isn't complete because I need to change it for user input, but this is a test. In a google sheets cell I type in =sortingtesting() function sortingtesting() { var pInfo1 = ['a','b','c','d','e',

Count number of Gmail emails per sender

随声附和 提交于 2020-08-23 08:03:57
问题 I'm trying to do a mass cleanout of my Gmail because search has gotten so slow. I would like to tally how many emails i've received from each sender. The closest solution I've found is this: https://webapps.stackexchange.com/questions/102162/can-i-get-a-list-of-the-senders-of-all-of-the-messages-in-my-inbox however that only tallies emails in Inbox, not in All Mail. I even tried moving all my 100k emails from All Mail to Inbox so that I could use it, but Gmail doesn't appear to let you move

Google spreadsheet - Colour rows if Strikethrough

半世苍凉 提交于 2020-08-23 07:02:33
问题 I have an online work spreadsheet with random cells marked as Strikethrough. So far there is no functions on Google spreadsheet to filter or isolate these cells which are marked as Strikethrough. I came across with Google function isStrikethrough() but not sure if that can be used on app script. What I am look as an outcome is to highlight the entire row if any cells in that row was marked Strikethrough. This will be very helpful if someone can help me by creating an app script. Thanks in

Google spreadsheet - Colour rows if Strikethrough

大城市里の小女人 提交于 2020-08-23 07:02:25
问题 I have an online work spreadsheet with random cells marked as Strikethrough. So far there is no functions on Google spreadsheet to filter or isolate these cells which are marked as Strikethrough. I came across with Google function isStrikethrough() but not sure if that can be used on app script. What I am look as an outcome is to highlight the entire row if any cells in that row was marked Strikethrough. This will be very helpful if someone can help me by creating an app script. Thanks in