How to get the correct range to set the value to a cell?
The following code does what is required function doTest() { SpreadsheetApp.getActiveSheet().getRange(‘F2’).setValue(‘Hello’); }
The following code does what is required function doTest() { SpreadsheetApp.getActiveSheet().getRange(‘F2’).setValue(‘Hello’); }
from the documentation : Custom functions return values, but they cannot set values outside the cells they are in. In most circumstances, a custom function in cell A1 cannot modify cell A5. However, if a custom function returns a double array, the results overflow the cell containing the function and fill the cells below and … Read more
onChange installable trigger works with edits made from sheets api. It is possible to get the edited range using .getActiveRange() calls.
The jsdoc variant suported for libraries in Google Apps Script does not support documentation at the level you are looking for, only first-level functions. There is a relevant open bug report on this, but no response from Google. You can still write your jsdoc tags, and generate your documentation outside of the Google infrastructure. Take … Read more
Yes, you can accomplish this using the Protection class. You would first protect the whole sheet using var protection = sheet.protect(), then unprotect the ranges you want people to be able to edit using protection.setUnprotectedRanges([ranges]), where [ranges] is an array of range objects. You can read more about it in the Google Apps Script Class … Read more
You want to retrieve values from the filtered sheet in the Spreadsheet. You want to achieve this using Google Apps Script. If my understanding is correct, how about this answer? Issue and workaround: Unfortunately, the values cannot be retrieved from the filtered sheet using getValues(). This has already been mentioned by TheMaster`s comment. As the … Read more
Click on the “Advanced” link and you’ll be able to authorize your script.
The GAS is not a precise version of JavaScript. It supports many features of JavaScript 1.8.5 like Object.keys, Object.isExtensible, etc. but on the other hand it does not support the keywords yield and let introduced in JavaScript 1.7. Another features which the GAS supports are the native JSON class and String.trim function introduced in JavaScript … Read more
Google Apps Script is a subset of JavaScript, spreadsheet functions are currently not supported. For example, if you want to create a function that returns today’s date you should write : function test_today(){ return new Date() }// note that this will eventually return a value in milliseconds , you’ll have to set the cell format … Read more
You can copy whole range at once using copyTo, so your function could be rewritten as: function copyInfo() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var copySheet = ss.getSheetByName(“Copy”); var pasteSheet = ss.getSheetByName(“Paste”); // get source range var source = copySheet.getRange(2,2,12,2); // get destination range var destination = pasteSheet.getRange(pasteSheet.getLastRow()+1,2,12,2); // copy values to destination range source.copyTo(destination); // … Read more