google-apps-script

How to run HTML from google library?

試著忘記壹切 提交于 2020-05-17 06:26:33
问题 I have a Google Library with HTML form, process form script addNewItem and script to run the form in popup window addItem . function addItem() { var html = HtmlService.createHtmlOutputFromFile('input/form.html'); SpreadsheetApp.getUi() .showModalDialog(html, 'Add New Recipe'); } function addNewItem(form_data) { var url = "SPREADSHEET_URL_TO_DATA_COLLECTION"; var ss = SpreadsheetApp.openByUrl(url); var sheet = ss.getSheetByName('List'); var asiaTime = Utilities.formatDate(new Date(), Session

CORS block: WebApp POST to Sheet

99封情书 提交于 2020-05-17 06:25:08
问题 I am getting an error due to CORS policy. It seems a common issue. I have read other questions and tried some of their solutions, but it still does not work. My app does the following: 1- GET a list of values from a google sheet and show them in a drop down list in a web app (still using script.google.com) 2- POST the value that the user select in the drop down list from the web app to the sheet. 1 (GET) was working fine with no issues. When I added 2 (POST), it gave me the CORS error for the

Retrieve values from Spreadsheet custom columns and put to template Document

余生颓废 提交于 2020-05-17 06:22:26
问题 This script, in my Spreadsheet, retrieve all values of columns of "A" and "B" that are the same for all rows and retrieve all values of columns of "C","D" and "E" that are variables for all the rows. The script creates one Google Document by replacing the placeholder by the values from Spreadsheet. The placeholder is enclosed by %. How to set, in the script, the columns if they change and so to set custom columns? function myFunction() { var templateGoogleDocumentID = "###"; // Please set the

How to reload a Google Apps Script web app with a link?

梦想的初衷 提交于 2020-05-17 05:53:16
问题 Some time ago I put together some lines to generate random colors, all of them under #777777. → https://script.google.com/macros/s/AKfycbyXRyJzSUo5wJxhuHliGpL-GPuhKPvZ3mBKtSDZKd4qyxbvIsk/exec This is the code: Code.js function doGet() { return HtmlService.createHtmlOutputFromFile('Index'); } Index.html <!DOCTYPE html> <html> <head> <style> body{ font-family:CourierNew; text-align:center; } </style> </head> <body onload="myFunction()"> <div id="color"></div> <script> function myFunction() {

ScriptApp.getService().getUrl() points to dev URL. How can I get it to point to exec production URL?

孤者浪人 提交于 2020-05-17 05:44:19
问题 ScriptApp.getService().getUrl() is generating a dev URL. How can I make it generate the exec production URL? 回答1: How about this answer? Please think of this as just one of several possible answers. Issue and workaround: If you are enabling V8 runtime, in the current stage, it seems that when V8 runtime is enabled, ScriptApp.getService().getUrl() returns the dev URL like https://script.google.com/macros/s/###/dev , and when V8 runtime is disabled, it returns the exec URL like https://script

How to set a value in the cells of the next column?

妖精的绣舞 提交于 2020-05-17 05:27:50
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

How to set a value in the cells of the next column?

筅森魡賤 提交于 2020-05-17 05:26:06
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

How to set a value in the cells of the next column?

人盡茶涼 提交于 2020-05-17 05:25:58
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

How do I use Google Apps Script to create a Google Calendar event with Hangouts Meet video call attached?

半世苍凉 提交于 2020-05-17 04:39:07
问题 I am looking for an example of Google Apps Script in which a new calendar event is created with a Hangouts Meet video conference call attached. For your reference, the most relevant article that I've found to accomplish this is found here. I hope that an example will help me understand what the script should look like so that I can reproduce it for my own purposes. So that there's no misunderstanding, I want to accomplish with Google Apps Script what I would accomplish if I used the "Add

App Script My Executions Entries Delayed/Missing

一曲冷凌霜 提交于 2020-05-16 21:58:10
问题 Recently, I've been having issues with My Executions having delays in adding the execution entries. The app script on the Google Sheet will run successfully (based on output), but there is no entry in the execution logs or the entry is delayed (10+ minutes). More worrisome, today I received an automatically generated email with a script error: "We're sorry, a server error occurred. Please wait a bit and try again." But there was no corresponding entry in executions. I've tried checking View