google-apps-script

Update value in a spreadsheet sidebar when next row is selected in table

老子叫甜甜 提交于 2020-12-13 07:06:24
问题 To facilitate the annotation of audio files in a Google spreadsheet, I'd like to implement an audio player in the sidebar which automatically plays the audio file mentioned as URL in the row of a table. After listening and entering some date in this row, I'd like to move to the next row and do the same. Thus, the URL to the audio file should be updated whenever I select a new row and the whole process should be fast, too, in order to listen quickly to one sound file after the other. I've

Writing into My Contacts

大憨熊 提交于 2020-12-13 05:02:58
问题 I have been trying to create contact in My Contacts folder, so it could be synced with my phone. I would't mind using groups, but their synchronization is broken on iPhone. Anyway, I am using this script: function update() { var group = ContactsApp.findContactGroup('My Contacts'); group.addContact(ContactsApp.createContact('Fido','McDog', 'fido@example.com')); var contact = ContactsApp.findByEmailAddress('fido@example.com'); contact.setWorkPhone('123123123123'); } If I use any other name for

Put a = before text jump

妖精的绣舞 提交于 2020-12-13 04:49:05
问题 Hello I made this script to export the data from a column to a .txt on my google drive function maquinasBonusHunt() { var ss = SpreadsheetApp.getActive(); var sheet = ss.getActiveSheet(); var range = sheet.getRange('G3:G' + sheet.getLastRow()); var rows = range.getValues().filter(([g]) => g.toString() != ""); var fileName="maquinas.txt"; var folderName="Videos"; var data = rows.splice(0); var str = data.map(function(e) {return e.join()}).join("\n"); var separador = [" - ", " = "]; var content

Creating a select (dropdown) input with a dynamic list of options in a gmail addon

落爺英雄遲暮 提交于 2020-12-13 04:39:05
问题 The Google App Script SelectionInput docs show selection inputs with a static list of options. Trying to create a dynamic options list like below: var items = [...]; var selectWidget = CardService.newSelectionInput() .setType(CardService.SelectionInputType.DROPDOWN) .setTitle("Select an item") .setFieldName("item"); items.forEach(function (item) { selectWidget.addItem(item, item, false); }); results in a runtime error: Object does not have property - /​Card/​sections[0]/​widgets[1]/​selection

You do not have access to library [xyz], used by your script, or it has been deleted

ⅰ亾dé卋堺 提交于 2020-12-13 04:38:07
问题 This was very likely a Google server error. Here are some details and the solution. This started at 8:55pm EDT (GMT -4) Friday, October 27 and continued for almost 3 days when I stopped waiting for it to fix itself like the last problem I commented on a few weeks ago. Nothing had changed in 17 days such that I should lose access. The script was most certainly still there. Everything involved was owned by "me." What may have triggered the problem is that I set one of my libraries--not even the

How to change Cloud Platform Project of a container-bound script programmatically?

耗尽温柔 提交于 2020-12-13 04:11:29
问题 I'm working on an automated Google Apps Script where I have a template Google Sheet where it has a container-bound script connected to specific Cloud Platform Project (Standard Project). When I copy the sheet programmatically, the container-bound script is copied correctly. However, the container-bound script is assigned to a dynamic Cloud Platform Project. Is there a way using Google Apps Script APIs to change the Cloud Platform Project from code? 来源: https://stackoverflow.com/questions

How to automatically rename folder based on uploaded file if there are duplicated folder name Google Form

馋奶兔 提交于 2020-12-13 03:58:07
问题 This is the next episode of my previous question (which was solved): Google Form Upload files to specific new folder based on the value submitted SO, I succeeded to create a new folder on Google Drive based on value inputted by user in field NAME using this script. function onFormSubmit(e) { const folderId = "###"; // Please set top folder ID of the destination folders. const form = FormApp.getActiveForm(); const formResponses = form.getResponses(); const itemResponses = formResponses

How to automatically rename folder based on uploaded file if there are duplicated folder name Google Form

馋奶兔 提交于 2020-12-13 03:57:46
问题 This is the next episode of my previous question (which was solved): Google Form Upload files to specific new folder based on the value submitted SO, I succeeded to create a new folder on Google Drive based on value inputted by user in field NAME using this script. function onFormSubmit(e) { const folderId = "###"; // Please set top folder ID of the destination folders. const form = FormApp.getActiveForm(); const formResponses = form.getResponses(); const itemResponses = formResponses

Clear content and copy from another sheet

流过昼夜 提交于 2020-12-13 03:53:23
问题 I have written a script that intends to clear the content of a Google Sheets spreadsheet and copy and paste the content of another sheet. The sheet that needs to be cleared is called "NEW_SHEET" and the one to be copied over is called "Database". For some reason, the script is not working at the moment. Nothing happens when I run it. Also, at the moment, I am using .getActiveRange to select the range to clear. However, I would like that to be columns A to AC and only to the last row with data

DocuSign REST API INVALID_CONTENT_TYPE sending envelope from template with application/json

*爱你&永不变心* 提交于 2020-12-13 03:52:52
问题 I am using Google Apps Script to make a URL request to https://demo.docusign.net/restapi/v2.1/accounts/ACCOUNT-ID/envelopes (where ACCOUNT-ID is my proper numerical account ID.) It's being sent with the code UrlFetchApp.fetch(url, params) . params is { muteHttpExceptions: true, method: "POST", headers: { Authorization: "Bearer "+jwt, ContentType: "application/json" }, payload: payload } jwt is a token retrieved from the JWT auth flow at execution time, and payload is { "accountId": accountID,