google-apps-script

Loop through columns looping through rows

孤者浪人 提交于 2021-01-28 01:52:20
问题 I'm trying to create a script that loops through columns and set variables from rows 2, 3 and 4. I've found the following example script and tried to rewrite it to loop through columns but when I replace "row" with "column" it still loops through rows. function sendEmails() { var sheet = SpreadsheetApp.getActiveSheet(); var startRow = 2; // First row of data to process var numRows = 2; // Number of rows to process // Fetch the range of cells A2:B3 var dataRange = sheet.getRange(startRow, 1,

Editing Form Responses Programmatically

夙愿已清 提交于 2021-01-28 01:08:02
问题 I have a google script that generates the edit URLs for each form response that is dumped into my spreadsheet. Is there a way to programatically change the response values as if I had actually opened the URL and changed the values manually? For example, suppose someone submitted a form with the name field being "Sam." I want to be able to programmatically edit this response so that the value of the same field is "Samuel." This is very easy to do manually via the form response edit url,

Why can't I get my UrlFetchApp.fetch to use the doGet()?

≯℡__Kan透↙ 提交于 2021-01-28 00:51:09
问题 If I use two forms that are both the same but one has a method of GET and one has a method of POST when I run them one uses the doGet and the other uses the doPost(). But that doesn't happen when I do the same thing with the UrlFetch() command by providing the input from a Prompt. The html: The top form is a GET and the bottom form is POST. <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <h3>GET</h3> <form action="https://script.google.com/a/cooper/macros/s

How do I format my text in Google Script, for it to show when I send an email?

纵饮孤独 提交于 2021-01-27 23:59:31
问题 I have been trying to edit a script that I have to bold certain text. This script pulls information from a Google Form Spreadsheet and returns an email that looks like this: Teacher Engagement: At initial observation, the teacher is appropriately engaged (Direct Instruction, Modeling, Constructing Knowledge, Guided/Independent Practice, etc.) Technology Integration: No evidence of technology use or integration I would like for the headers "Teacher Engagement:" & "Technology Integration" to be

Google Sheets - Multiple dependent drop-down lists

偶尔善良 提交于 2021-01-27 23:38:58
问题 I am trying to create a dependent list as described and answered (with a script) here. I would like to achieve that if selecting a certain value (e.g. "First") from a cell in column 1, then the drop-down options from the next cell in the same row should offer a range of values from the column in a different sheet with the same heading as the value in the first - left - cell (i.e. the first sheet is called "Selector" - in which there are dropdowns, in the second sheet called "KAT" I have the

call an image from URL in Apps Script

霸气de小男生 提交于 2021-01-27 22:56:46
问题 I programmed one that calls a Google Doc and in said Doc there is a variable called #Name# this is replaced by the name that is stored in a SpreadSheet. My question is that to that Doc I want to add a variable called # Photo # and it is replaced by the photo stored in a Drive URL and this URL is in a SpreadSheet How can I call that URL that is in Spreadsheet and be able to replace the field #photo# With the name it does well with the function body.replaceText ('#name#', name); but with the

Can Google Slide modalDialog HTML javascript run server-side code? Environment Apps Script

眉间皱痕 提交于 2021-01-27 22:51:19
问题 https://developers.google.com/apps-script/guides/html/reference/run https://developers.google.com/apps-script/guides/html/communication Do not list slides. Alerts in my code show the javascript running but not the server side code. <!DOCTYPE html> <html> <head> <base target="_top"> <style> ... removed CSS for simplicity </style> </head> <body> <div id="parent"> <div id="child"> <?!= nextQuestion ?> <p></p> <input type="button" value="Okay!" id="subBut" /> <input type="button" value="Not quite

Create a google spreadsheet in same folder as current file

爷,独闯天下 提交于 2021-01-27 21:37:33
问题 I have a google form script that I want to create a spreadsheet in the same folder as the form. var thisFileId = form.getId(); var parentFolder = DriveApp.getFolderById(thisFileId) spreadsheet = SpreadsheetApp.create(spreadsheetName); var spreadsheetID = spreadsheet.getId(); var spreasheetFile = DriveApp.getFileById(spreadsheetID); spreasheetFile.moveTo(parentFolder); I get an error on the last line : "Exception: Invalid argument: parent.mimeType" 回答1: I believe your goal as follows. You want

How to compare current edited time vs. specified criteria time in an IF Statement in Google Apps Script/Sheets?

。_饼干妹妹 提交于 2021-01-27 21:34:35
问题 Goal: Insert the current date or tomorrow's date to a cell under Column K/Row of user edit, depending on when the user changes a cell under Column D to "Chat => Email." And if possible, I want the comparison and output of the date to be based on the JST (Japan Standard Time) time zone. Context of my code: In my below code, I've created a function called "insertDeadlineDate()" which receives onEdit() information from another .gs file. Within the insertDeadlineDate() code, I'm trying to create

How to indent code on new google appscript interface?

眉间皱痕 提交于 2021-01-27 21:33:00
问题 Any guidance on how to indent / turn on auto indent on google appscript with shortcuts would be appreciated! 回答1: What I am using when indenting manually is Tab and Shift + Tab on single or multiple lines. Tab for shifting it to the right. Shift + Tab for shifting it to the left. After { , when pressing Enter , it should auto indent itself to the right on the next line. For Auto Formatting, press Ctrl + Shift + I to format the whole file. Or right click in the editor then you can see the