google-apps-script

Why I can' see new version google apps script editor?

限于喜欢 提交于 2021-02-02 09:53:10
问题 I'm in Japan. By now I still just can see the legacy version. Anyone know why? I googled but got no answer. And there is no button for switch between legacy version and the new version. 回答1: Updates from workspace blog say Update This post has been updated to reflect a change in rollout pace. It is now an extended rollout (longer than 15 days for feature visibility), which we expect to complete in January 2021. We previously stated it would be a gradual rollout (up to 15 days for feature

Show Alert Popup when cell selection is changed (onSelectionChange)

不打扰是莪最后的温柔 提交于 2021-02-02 09:44:26
问题 I am trying to show an alert popup when cell selection is changed, using the new trigger onSelectionChange . For some reason it is not showing any alerts. Am i doing something wrong or alerts does not work with this trigger? function onSelectionChange(e) { showAlert(); } function showAlert() { var ui = SpreadsheetApp.getUi(); var result = ui.alert( 'ALERT!', 'ALERT MESSAGE.', ui.ButtonSet.OK); } I also tried that way: function onSelectionChange(e) { var ui = SpreadsheetApp.getUi(); var result

How to use in Google Sheets setValue only for range of filtered rows (getRange for not hidden cells)?

泄露秘密 提交于 2021-02-02 09:41:53
问题 I want to know, how to use setValue, if there are filtered rows, so that only the shown rows (C1 + one row down to last row of C) get a value. x(){ var sheet = SpreadsheetApp.getActiveSheet(); var lastRow = sheet.getLastRow(); sheet.getRange(C2, lastRow).setValue('x'); } Update It works, but very slowly. I have tested the following code and it works fast. It must start in the second shown row. The following solution works both with and without filter. What is not yet running is the second row

How to use in Google Sheets setValue only for range of filtered rows (getRange for not hidden cells)?

假装没事ソ 提交于 2021-02-02 09:41:06
问题 I want to know, how to use setValue, if there are filtered rows, so that only the shown rows (C1 + one row down to last row of C) get a value. x(){ var sheet = SpreadsheetApp.getActiveSheet(); var lastRow = sheet.getLastRow(); sheet.getRange(C2, lastRow).setValue('x'); } Update It works, but very slowly. I have tested the following code and it works fast. It must start in the second shown row. The following solution works both with and without filter. What is not yet running is the second row

Error when running Youtube Data Service in App Scripts (js) – Daily Limit for Unauthenticated Use Exceeded

∥☆過路亽.° 提交于 2021-02-02 09:37:28
问题 I'm running a custom function in App Scripts which utilizes the Youtube (YouTube Data API v3) advanced service. When running, I get the following error: GoogleJsonResponseException: API call to youtube.videos.list failed with error: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup. (line 15). I'm not sure how to authenticate my application. I've added it to a cloud project and enabled the API's. Update: Here's what my code looks like: function getYoutubeData

Google script formatDate off by 1 year when input date is Dec 30 or 31

一曲冷凌霜 提交于 2021-02-02 09:36:53
问题 When using Utilities.formatDate it seems to be adding a year when processing December 30 or 31. I created this snippet to demonstrate the issue: function myFunction() { start = new Date("29 Dec 2018") for(i=0;i<4;i++){ Logger.log("Test:" + start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getYear()) test(start) start.setDate(start.getDate()+1) } } function test(SrcDate) { Logger.log("SrcDate: " + SrcDate) Logger.log("toISOString: " + SrcDate.toISOString()) Logger.log("Zulu: " +

Error when running Youtube Data Service in App Scripts (js) – Daily Limit for Unauthenticated Use Exceeded

白昼怎懂夜的黑 提交于 2021-02-02 09:35:21
问题 I'm running a custom function in App Scripts which utilizes the Youtube (YouTube Data API v3) advanced service. When running, I get the following error: GoogleJsonResponseException: API call to youtube.videos.list failed with error: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup. (line 15). I'm not sure how to authenticate my application. I've added it to a cloud project and enabled the API's. Update: Here's what my code looks like: function getYoutubeData

Is this redundant?

混江龙づ霸主 提交于 2021-02-02 09:34:25
问题 Is this redundant? Is there a simpler way to write this? if(e.range.getSheet().getName() == 'Estimate'){ var thisss = SpreadsheetApp.getActive().getSheetByName('Estimate'); } 回答1: Yes. This is known as WET solution. The DRY(Don't repeat yourself) principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system". Simply put, If you trace a branch of code(say, a variable information), it should have a single line to the root of the

Google Spreadsheet - Show sheets depending on type of user

混江龙づ霸主 提交于 2021-02-02 09:30:25
问题 Is there a way, to make a certain sheet in Google Spreadsheets, be editable and accessible to a certain type of user, while not be accessible to another type of user? I currently have a Google App Script project, that allows a certain user to use an HTML form to input certain parameters, and a Google Spreadsheet is automatically created for him (thus, everything in the spreadsheet is created programatically). This new spreadsheet should have access by different "types" of users. A "type" of

Google Spreadsheet - Show sheets depending on type of user

[亡魂溺海] 提交于 2021-02-02 09:30:20
问题 Is there a way, to make a certain sheet in Google Spreadsheets, be editable and accessible to a certain type of user, while not be accessible to another type of user? I currently have a Google App Script project, that allows a certain user to use an HTML form to input certain parameters, and a Google Spreadsheet is automatically created for him (thus, everything in the spreadsheet is created programatically). This new spreadsheet should have access by different "types" of users. A "type" of