Posts

Showing posts with the label AppScripting

Google Apps Script Integration with Version control tool Bitbucket

Image
What is version control tools? Version control systems are a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made , developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimising disruption to all team members. Top version control tools for system:  Bitbucket  (Unlimited private and public repository)-- Currently I am using Github (free to create public repository) How to create/register account on Bitbucket Sign Up  Bitbucket It will check entered email Id, if it is correct it will ask User name and Password for Bitucket account. Check on I'm not robot option. Click on Continue, It will show next window " Verify your email " Bitbucket team will sent email on your given Id login your email, check email from  Atlassian (<no...

Google Apps Script Exception Handling

Image
Errors In Computer Programming There are three types of common errors in programming: Syntax Errors Runtime Errors Logical Errors i) Syntax Errors Syntax errors, also called parsing errors , occur at compile time in traditional programming languages and at interpret time in Google Apps Script. For example, the following line causes a syntax error because we used Variable name V caps. function errorTest(){ Var num1=100; } Try to Save ( Ctrl+S ) Error log:  Missing ; before statement. (line 47, file "RegEx") When a syntax error occurs in Google Apps Script, IDE don't allow to save the last changes. ii) Runtime Errors Runtime errors, also called exceptions , occur during execution (after compilation/interpretation). For example, the following line causes a runtime error because here the syntax is correct, but at runtime, it is trying to call a function that does not exist. function errorTest2(){ var test=method(); Logger.log(t...

Google Apps Script Regular Expressions

Image
RegEx A regular expression, also called a regex , is a method for matching text with patterns. For example, a regular expression can describe the pattern of email addresses, URLs, telephone numbers, employee identification numbers, social security numbers, or credit card numbers. What Is a Regular Expression? A sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text. When you search for data in a text, you can use this search pattern to describe what you are searching for. A regular expression can be a single character or a more complicated pattern. Regular expressions can be used to perform all types of text search and text replace operations. Ref Google: For additional instructions and guidelines, see also Guidelines for using regular expressions and RE2 Syntax . Syntax /pattern/modifiers; var patt = /googleAppsScript/i; / googleAppsScript /i  is a regular expression. googleAppsScr...

Google Apps Script Loops

Loops can execute a block of code a number of times. Loops are handy, If in Google Apps Script you want to run the same code over and over again, use loops. Often this is the case when working with arrays and Google Sheet: Different Kinds of Loops Google Apps Script supports different kinds of loops: for - loops through a block of code a number of times. for/in - loops through the properties of an object. while - loops through a block of code while a specified condition is true. do/while - also loops through a block of code while a specified condition is true. For Loop The for loop is often the tool you will use when you want to create a loop. Syntax for ( statement 1 ; statement 2 ; statement 3 ) {     code block to be executed } Note: Statement 1 is executed before the loop (the code block) starts. Statement 2 defines the condition for running the loop (the code block). Statement 3 is executed each time after the loop ...

Google Apps Script Conditional Statements

Conditional statements are used to perform different actions based on different conditions. Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. Google Apps Script will have the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true Use else to specify a block of code to be executed, if the same condition is false Use else if to specify a new condition to test, if the first condition is false Use switch to specify many alternative blocks of code to be executed if Statement Use the if statement to specify a block of Google Apps Script code to be executed if a condition is true . Syntax if ( condition ) { block of code to be executed if the condition is true; } Example “Check voting age in India” function ifCond() {  try{    var age=18;  ...