w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » GOOGLE APPS SCRIPT » Page 1
function sendMailonChange: with a gmail adress in the google form the script does not work
Gabriel, Can you make sure you are logged into the ****@gmail.com account when you are executing the script? I think you must be logged in to the account you are trying to send from. Also, the from value must be one of your aliases. This is explained in Google's documentation. It describes the Advanced Parameter from: from String the address that the email should be sent from, which mus

Categories : Google Apps Script

Cannot start publishing my Google App Script as Add-on
The reason you are not able to see that "Deploy as add-on" option because, you might be opening the normal Apps script console(script.google.com). But if you want to publish your script code as an add-on, you have to open the script editor from the Doc or sheet which is bound to the script. Open the Doc, Tools--> Script editor. Then go to Publish, now you can see an option for "Deploy as add-o

Categories : Google Apps Script

Google Apps Script - Run javascript as the form is being filled by users
Unfortunately this is not currently possible with Google Apps Script and Google Forms. Apps Script can be triggered by the submission of a Form, but it cannot interact with the Form in the users browser. It is possible to build a form entirely in Apps Script (using HTML) which would allow you full control over the user experience, but you lose access to the functionality provided by Google Forms

Categories : Google Apps Script

How can I move the cursor to the beginning of the document with Google Apps Script for Docs?
This is very simple, you can use the setCursor() method documented here. Example code : function setCursorToStart() { var doc = DocumentApp.getActiveDocument(); var paragraph = doc.getBody().getChild(0); var position = doc.newPosition(paragraph.getChild(0), 0); doc.setCursor(position); } This will set the cursor position to the start of your document but in your question you say you want t

Categories : Google Apps Script

Google Apps Script -> write Text from Document to Sheet
Using DocumentApp.getActiveDocument().getBody().getParagraphs(), you can access a document's paragraphs. Of course you can replace DocumentApp.getActiveDocument() with a reference to a document you are handling.

Categories : Google Apps Script

.getDataRange not the true range after a .setFormula
Tried to implement it this way and it worked well for me. function getNewFormulaRange(){ var sheet = SpreadsheetApp.getActiveSheet(); var last_row = sheet.getLastRow(); var last_column = sheet.getLastColumn(); Logger.log('1: ' + last_row); var range_input = sheet.getRange(1,1,last_row,last_column); var cell = sheet.getRange(last_row+1,10); cell.setFormula("=SUM(B3:B4)"); Spreadshe

Categories : Google Apps Script

how do I get Add and Sum by column index value in Google Spreasheet
Assuming you have the names in Col A and the col A of the example is actually Col B, in the summary sheet, try something like: =ArrayFormula(query({'raw sheet'!A2:A,'raw sheet'!B2:B*'raw sheet'!C2:C}, "select Col1, sum(Col2) where Col1 <>'' group By Col1 label sum(Col2) 'TOTAL' "))

Categories : Google Apps Script

How can I pause the execution of code in google script until the entire spreadsheet gets updated?
As Anees mentioned in the comments, the flush() command is what you are looking for. SpreadsheetApp.flush(); https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#flush()

Categories : Google Apps Script

Drive PDF revision ids are being ignored
Google engineers have reproduced the problem using the code shown below, and have raised an internal bug report regarding this. While the sample code is in Google Apps Script, the problem is in Google Drive itself. You may track any progress by visiting and starring Issue 4008 on the google-drive-sdk Issue Tracker. function test() { var content = Utilities.newBlob('Apple', 'text/plain'); var

Categories : Google Apps Script

Update to first cell in Google Sheet color change
The code added here is working perfectly fine for me. However make sure you are not testing this code on an empty Google Sheet, as the below code returns values based on the text values in the cells not based on the background colors. var last_row = sheet.getLastRow(); var last_column = sheet.getLastColumn(); Also able to view the Execution Transcript in Apps Script console correctly. Hope th

Categories : Google Apps Script

GoogleSheets Script get logged in user to hide/show columns
So, here's a very simple adjustment that does what you describe, but I wasn't going to mess about with the 'Clicking and image' thing, you'll have to find how it's going to work with your existing code. The following will open/close columns based on your email using a simple 'onOpen' trigger: function onOpen(e){ var email = (Session.getEffectiveUser().getEmail()); var sheet = SpreadsheetApp

Categories : Google Apps Script

add file property (like jQuery's .data()) to a GDrive file - Google App Script
It sounds like what might interest you is Drives custom file properties. You can find more on the methods here. I'm pretty new to programming, and I've never used this particular feature, but I believe it will allow you to specify custom properties for Drive files.

Categories : Google Apps Script

Passing custom Spreadsheets column to onFormSubmit trigger
When you use e.namedValues['NUM1'], you are getting the "namedValues" property of the e object which is actually the response coming from the form. I' m quite surprised by the result you get since nor property in this object is called "TOT"... normally it should return "undefined" obviously. Nevertheless, this is not you actual question, what you want is simply the numeric sum of both values, y

Categories : Google Apps Script

Google Apps substring from null
This was driving me nuts, as there was no reason your code wouldn't work, and I was getting the same error. I narrowed it down to the 'getPlainBody()' was returning 'null', but couldn't figure out why this was the case even when I used GMails own example. I was almost going to call it a bug when I realized that what was happening was that some messages were returning nothing in the body. Specifi

Categories : Google Apps Script

Getting and using the value from text box
if the name attribute of the textbox is userName then it would be. document.getElementsByName('userName')[0].value; If you have an id to the textbox it would be document.getElementById('userName').value;

Categories : Google Apps Script

Google Apps Script - HTML service "createTemplateFromFile" not usable from within App (spreadsheet, etc.)?
You need to evaluate() a template to create an HtmlOutput object. function showSidebar(){ var html = HtmlService.createTemplateFromFile('changeDialog'); var a = "test"; SpreadsheetApp.getUi() .showSidebar(html.evaluate()); ////////// } Since your changeDialog.html file contains no template tags, you could instead create an HTML file from it directly: f

Categories : Google Apps Script

error - "Method Range.getValue is heavily used by the script"
Is it an error or an execution hint(the light bulb in the menu)? are you using that method on other part of your code? probably in listLatestFile()? I got the same execution hint by calling getRange().getValue() in listLatestFile() (using a loop) and the hint always mentioned that the problem was when calling var ffile = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("CtrlSht").getRange("

Categories : Google Apps Script

Webapp to return specific text responses for a URL parameter
See this answer for an example of serving multiple html pages using HtmlService. The basic idea is to write doGet() to accept a query parameter that it will use to select which html page to serve. In your case, instead of serving HTML pages, you should use the ContentService to output the appropriate response, based on the evaluation of the received parameters. function doGet(e) { if (!e.par

Categories : Google Apps Script

Google spreadsheet add row on first edit of a cell
You can implement this code below. function onEdit(e) { var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var row = e.range.getRow(); var column = e.range.getColumn(); var lastRow = sheet.getLastRow(); if(column == 1 && row == (lastRow-2) ){sheet.insertRowAfter(row);} } It works fine other than date validation step.You can try adding some data val

Categories : Google Apps Script

Google form (onEdit)
Have a look at the google apps script guides. https://developers.google.com/apps-script/guides/triggers/#available_types_of_triggers There you see that the onEdit trigger is only available for Sheets. However, it seems you could use a installable trigger that will fire on form submit.

Categories : Google Apps Script

Open a file from Google Sheets script
I find it strange that it ever worked before! If it did, it was probably a bug - pretty sure it was never intended to work like that with "local" files... I have never seen it mentioned anywhere that UrlFetchApp.fetch() can fetch "local" files like that. A simple fix would be to just use proper full url of the file: var myHtmlFile = UrlFetchApp.fetch("https://googledrive.com/host/{public_folder_

Categories : Google Apps Script

How to automatically import data from uploaded CSV or XLS file into Google Sheets
You can programmatically import data from a csv file in your Drive into an existing Google Sheet using Google Apps Script, replacing/appending data as needed. Below is some sample code. It assumes that: a) you have a designated folder in your Drive where the CSV file is saved/uploaded to; b) the CSV file is named "report.csv" and the data in it comma-delimited; and c) the CSV data is imported in

Categories : Google Apps Script

First cell in active row during script execution
Change var range_output = sheet.getRange("A1"); to the range you want edit. You could do this in the loop: for(var r = 0; r < cell_colors.length; r++) { for(var c = 0; c < cell_colors[0].length; c++) { if(cell_colors[r][c] == color) { count++; // Assuming you only want to change bg color of the first column on each row sheet.getRange(r,1).setBackground("#

Categories : Google Apps Script

Troubleshooting script to amend Google Calendar from Google Sheets
There are some changes you can do in the function amendCalEvents 1.- numRows variable, you are setting the value of getLasRow but you are not subtracting the rows used for the first information (e.g. if you have just 1 calendar and this calendar has one event, when you run the first function it'll add a new row and this variable will have 3 as value. so when you u call the function getRange, it w

Categories : Google Apps Script

how to check whether cell has anything in it
Have you tried isBlank() in the Range class? https://developers.google.com/apps-script/reference/spreadsheet/range#isBlank()

Categories : Google Apps Script

Is there a better way than eval() in this scenario?
Well, it looks secure enough. But using eval has other problems, like making it difficult to debug your code, and possibly some other problems. If you're generating such custom data within your code, I imagine the variety of such customizations is enumerable. If so, I'd leave the code within your script and save in Drive just data and use indicators (like function variants names) of how to rebuil

Categories : Google Apps Script

Formatting Date in Spreadsheet
Did you try using "formatDate" in Utilities class formatDate(date, timeZone, format) try doing this: var dateToFormat = row[0]; var formattedDate = Utilities.formatDate(new Date(dateToFormat), "GMT", "EEE, MMM d, yyyy"); Logger.log(formattedDate);

Categories : Google Apps Script

Google Apps Script [MailApp] including multiple data
Use join() array method to concatenate your array into a string: htmlBody: groupList.join("<br>")

Categories : Google Apps Script

How to transform all data in sheet to values - google spreadsheets
To give a global logic. You should probably look these methods. SpreadsheetApp.Spreadsheet.Sheet.Range.getValues(); and SpreadsheetApp.Spreadsheet.Sheet.Range.setValues(); If my I'm not mistaken, this functions should get your datas in 2D Array. Then paste Them as String in your spreadsheet. Cheers

Categories : Google Apps Script

Delete row in other sheets based on 2 values on main file
Try this: function removeDuplicate(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var mainsheet = ss.getSheetByName("Sheet1"); var sheet2 = ss.getSheetByName("Sheet2"); var sheet3 = ss.getSheetByName("Sheet3"); var masterData = mainsheet.getDataRange().getValues(); var sheetsToCheck = [sheet2,sheet3]; for(var i in sheetsToCheck){ var va

Categories : Google Apps Script

Re-using a Google docs project without publishing it
I see the only way is to share the original/copy of that document. This shares the Apps Script project with the Google Doc and the changes in the Apps Script project reflects to the other shared users, but the updates in the Google Doc shared will not be updated to the other users. You can also try this option by sharing them as a Container-bound projects Hope that helps!

Categories : Google Apps Script

how to edit sites by using Google Apps Script?
Here is a link for the tutorial if you want to change your site's layout, Theme, colors or font. However if you want to edit your Google Site by using Google Apps Script, here are the links that will be useful: https://support.google.com/sites/answer/1224164 https://developers.google.com/apps-script/reference/sites/ Hope that helps!

Categories : Google Apps Script

gas spreadsheet authorization
You have to run the doGet function - or any other function in the same project - just once from the script editor before you can use the webapp. This will trigger the authorization process (showing one or more popups depending on the services you use in that project) and is a necessary step.

Categories : Google Apps Script

Google Script to Submit Form to Calendar Event
Here is a "sorcery gift" since you're a teacher (so am I) and not a programmer (neither am I) that hopefully does exactly what you need. EDIT : I added the submission date/time in description function createCalEvent(e) { Logger.log(e); // this will return something like this : /* {values=[11/9/2014 22:30:00, serge, test descr, 11/7/2014, Before school | 7:30], namedValues={Your Full N

Categories : Google Apps Script

Google Sites gadgets, extra scroll bars, footer menu
You can't eliminate the left and right margins, but you can minimize them by choosing a template that doesn't have a very wide side margins, like the "Ember" theme. Go into MANAGE SITE; at the bottom of the list, choose "Themes, Colors, and Fonts", and change the BASE THEME TO "Ember". That theme has a fairly thin left and right margin. Use an HTML App in an Apps Script Gadget for your HTML

Categories : Google Apps Script

Google Spreadsheet Script to selectively protect certain cells?
Unfortunately, it's not currently possible to manipulate the 'Protect Range' with Google Apps script. There's currently an open issue with this here, which you should star for traction and to receive updates on if this is resolved. Currently you can only protect an entire page, which looking at your sheet, won't do you much good I think.

Categories : Google Apps Script

schema.org markup for emails not working on gmail
The above email markup contains minimal set of information to define an Event Reservation. You can markup other pieces of information in your emails to improve the user experience. For instance, to get a action button you should consider adding the "modifyReservationUrl" in the markup. Modified the above markup to generate action button in the email. <html> <body> <div itemscop

Categories : Google Apps Script

MailFred Issue Emails
Go to your Google Accounts Settings and under Security, click the Apps and Websites link. Here you'll see a list of all scripts that have access to your Google Account. Revoke access to the one that is sending those error notifications.

Categories : Google Apps Script

How do you open a Google form from a Custom Menu Item
One quick and dirty way. Upon menu click: Create a UI app. Create a hyperlink to the published form, instructing user to click link to add a new quote. Add link to UI app. Display UI app. Example: function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('Quote Generator Menu') .addItem('Create New Quote', 'showUrl') .addToUi(); } // http://stackoverflow.com/questions/26

Categories : Google Apps Script




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.