google-apps-script

How to get file (video) duration of google drive file programmatically?

淺唱寂寞╮ 提交于 2020-03-23 07:54:57
问题 Either using rest API, Google Scripts, Node SDK, whatever works. I'm seeing this in the docs but that doesn't seem to tell me the duration: function watchFile(fileId, channelId, channelType, channelAddress) { var resource = { 'id': channelId, 'type': channelType, 'address': channelAddress }; var request = gapi.client.drive.files.watch({ 'fileId': fileId, 'resource': resource }); request.execute(function(channel){console.log(channel);}); } I found this link but it doesn't seem to help https:/

Using Google appscript to refresh tables pasted in from Google sheets into Google slides

旧街凉风 提交于 2020-03-23 07:27:44
问题 This question here has as succinct solution for updating Google Sheets charts linked to Google slides. function onOpen() { var ui = SlidesApp.getUi(); ui.createMenu('Custom Menu') .addItem('Batch Update Charts', 'batchUpdate') .addToUi(); } function batchUpdate(){ var gotSlides = SlidesApp.getActivePresentation().getSlides(); for (var i = 0; i < gotSlides.length; i++) { var slide = gotSlides[i]; var sheetsCharts = slide.getSheetsCharts(); for (var k = 0; k < sheetsCharts.length; k++) { var

Change Google Calendar Event Free/Busy with Calendar API

一笑奈何 提交于 2020-03-22 10:34:03
问题 I have a GAS web app for reserving rooms. When the app creates the event, it currently defaults to "Busy" for the event. I am trying to set the default to "Free". I found a GAS forum entry that recommends using the Advanced Google Calendar API to edit the transparency field (Source: https://code.google.com/p/google-apps-script-issues/issues/detail?id=2341). The script they suggested was var changes = { transparency: "transparent" }; Calendar.Events.patch(changes, cal_id, event_id); I have the

Change Google Calendar Event Free/Busy with Calendar API

非 Y 不嫁゛ 提交于 2020-03-22 10:32:42
问题 I have a GAS web app for reserving rooms. When the app creates the event, it currently defaults to "Busy" for the event. I am trying to set the default to "Free". I found a GAS forum entry that recommends using the Advanced Google Calendar API to edit the transparency field (Source: https://code.google.com/p/google-apps-script-issues/issues/detail?id=2341). The script they suggested was var changes = { transparency: "transparent" }; Calendar.Events.patch(changes, cal_id, event_id); I have the

Change Google Calendar Event Free/Busy with Calendar API

你说的曾经没有我的故事 提交于 2020-03-22 10:32:32
问题 I have a GAS web app for reserving rooms. When the app creates the event, it currently defaults to "Busy" for the event. I am trying to set the default to "Free". I found a GAS forum entry that recommends using the Advanced Google Calendar API to edit the transparency field (Source: https://code.google.com/p/google-apps-script-issues/issues/detail?id=2341). The script they suggested was var changes = { transparency: "transparent" }; Calendar.Events.patch(changes, cal_id, event_id); I have the

Google App Script postMessage does not match recipient window's origin

元气小坏坏 提交于 2020-03-22 10:27:12
问题 I have a Google App Script deployed as a Web application. It was working normally, until this evening I discovered it would not load in Firefox or Chrome. In Firefox I am getting this message; Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://n-...-0lu-script.googleusercontent.com’) does not match the recipient window’s origin (‘https://script.google.com’). Removed part of URL The app is deployed: (Executing as myself , and is Accessible for anyone, even

No item with the given ID can be found onSubmit Google Form

末鹿安然 提交于 2020-03-22 09:04:09
问题 I created a script that runs onSubmit on a Google Form. It should get the ID of the image uploaded to the form, get the Image as Blob and then forward it to some email adress. The thing is, is that sometimes (about 1 in 10), the script gives the following error: Exception: No item with the given ID could be found, or you do not have permission to access it. at on_Submit(Code:6:24) I figured it would have to do with the time it takes Google to Upload/Move the file into Drive, so I set a

No item with the given ID can be found onSubmit Google Form

喜欢而已 提交于 2020-03-22 09:04:08
问题 I created a script that runs onSubmit on a Google Form. It should get the ID of the image uploaded to the form, get the Image as Blob and then forward it to some email adress. The thing is, is that sometimes (about 1 in 10), the script gives the following error: Exception: No item with the given ID could be found, or you do not have permission to access it. at on_Submit(Code:6:24) I figured it would have to do with the time it takes Google to Upload/Move the file into Drive, so I set a

UrlFetchApp.fetch with very long URLs

ⅰ亾dé卋堺 提交于 2020-03-22 06:12:06
问题 New to Google Apps Script, trying to retrieve data from a URL with UrlFetchApp.fetch but the URL length is limited to 2kB per call (https://developers.google.com/apps-script/guides/services/quotas). Thus, with a long URL I get the error Limit Exceeded: URLFetch URL Length. . Example: var url = 'http://www.longurlmaker.com/go?id

Get user info when someone runs Google Apps Script web app as me

ⅰ亾dé卋堺 提交于 2020-03-21 08:27:50
问题 I have a standalone Google Apps Script deployed as a web app. The app is executed as me, because I want it to access files stored on my Drive, and because I want it to generate Google Sheets files that have some ranges protected from the user that are still editable by the script. However, I want these files to be segregated into folders, and each folder is assigned to a user, so I need to know who the user is each time the app runs. Session.getActiveUser().getEmail() doesn't work since the