Enter the same value in every cell of a Range in Google Sheets using Apps Script
I recently found out that there is a very easy way to enter the same value in every cell of a Range in Google Sheets using Apps Script.
Prerequisites
This tutorial assumes that you're familiar with the following concepts:
All you have to do is select the range and then use the setValue()
method of the Range object.
function setValueToEveryCellInRange() {
var range = SpreadsheetApp.getActiveSheet().getRange(1,1,5,5);
range.setValue("Hello");
}
The above code selects the range A1:E5
of the sheet that is active (i.e., the selected sheet in your spreadsheet) and enters the text "Hello" in every cell.

Thanks for reading!
DISCLAIMER: This content is provided for educational purposes only. All code, templates, and information should be thoroughly reviewed and tested before use. Use at your own risk. Full Terms of Service apply.
Small Scripts, Big Impact
Join 1,500+ professionals who are supercharging their productivity with Google Sheets automation
By subscribing, you agree to our Privacy Policy and Terms of Service