Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-online.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-unread.php on line 43

Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-unread.php on line 82
How to Get and Set Cell Values in Active Sheet – Google sheet in Tamil – 8 – Sithtamil – My Notes

Forum

Please or Register to create posts and topics.

How to Get and Set Cell Values in Active Sheet - Google sheet in Tamil - 8

What is variable?
In computer programming and mathematics, a variable is a fundamental concept that represents a named storage location in memory where data can be stored and manipulated. Variables are used to store different types of information, such as numbers, text, or complex data structures. They are essential for writing programs, performing calculations, and managing data.

var x;
var y= "sithtamil"
function variable{logger.log(y) var y= "sith" logger.log(y)
var a=2; var b=5; var c=a*b; logger.log(c) logger.log(typeof a)}
function variable2{ logger.log(typeof a)}
function variable3{const phi=3.14 logger.log(phi) phi=3.14}

In JavaScript, you can assign a variable using the var, let, or const keywords followed by the variable name, an equal sign (=), and the value you want to assign. The choice of which keyword to use depends on the scope and mutability requirements of the variable:

var (Function-Scoped):Variables declared with var are function-scoped, meaning they are accessible within the function in which they are defined. They are hoisted to the top of their containing function or global scope, so you can access them even before they are declared.
var x = 10;

let (Block-Scoped): Variables declared with let are block-scoped, meaning they are accessible within the block (enclosed by curly braces {}) in which they are defined. This includes loops, conditionals, and functions. They are not hoisted to the top of their containing block.
let y = 20;


const (Block-Scoped, Immutable): Variables declared with const are also block-scoped. They are used for declaring constants, which means their values cannot be reassigned after initialization.
const pi = 3.14;

Function tutorial1() {

Logger.log("sithtamil & sithtamil!");
var app = SpreadsheetApp;
var ss= app.getActiveSpreadsheet();
var activesheet=ss.getActiveSheet();
activesheet.getRange("D2:F8").setValue("sith!");
activesheet.getRange(6,2).setValue("tamil!");
activesheet.getRange(2,2,3).setValue("sithtamil");
activesheet.getRange(2,2,3,4).setValue("sithtamil***");
var tempText = activesheet.getRange(4,1).getValue();
activesheet.getRange(6,2).setValue(tempText);
}

Writing Data to a Range:

To write data to a range of cells, you can use the getRange() method to define the range where you want to write the data and then use the setValue() method to set the value of that range.
function writeData() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getRange("B2"); // Define the range, e.g., cell B2
range.setValue("Hello, world!"); // Set the value of the range
}

Reading Data from a Range:

To read data from a range of cells, you can use the getRange() method to define the range you want to access and then use the getValue() method to retrieve the value from that range.

function readData() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getRange("A1"); // Define the range, e.g., cell A1
var value = range.getValue(); // Get the value from the range
Logger.log("Value in A1: " + value);
}