I want to set text or number in Google Sheet from script.
I want to set Hello
or number 9
in cell F2
. I found this code so far:
SpreadsheetApp.getActiveRange().setValue('hello');
but that doesn't specify which cell.
I want to set text or number in Google Sheet from script.
I want to set Hello
or number 9
in cell F2
. I found this code so far:
SpreadsheetApp.getActiveRange().setValue('hello');
but that doesn't specify which cell.
Setting value in a cell in spreadsheet to which script is attached
Setting value in a cell in sheet which is open currently and to which script is attached
Setting value in a cell in some spreadsheet to which script is NOT attached (Destination sheet name known)
Setting value in a cell in some spreadsheet to which script is NOT attached (Destination sheet position known)
These are constants, you must define them yourself
By script attached to a sheet I mean that script is residing in the script editor of that sheet. Not attached means not residing in the script editor of that sheet. It can be in any other place.
Use
setValue
method ofRange
class to set the value of particular cell.You can also select a cell using row and column numbers.
It's also possible to set value of multiple cells at once.
The following code does what is required