4 scripts to make Google Sheets stronger

Google Sheets or Google Sheets is one of the most powerful free tools, allowing you to track, analyze or take notes of everything you can imagine. Not stopping there, you can enhance its capabilities with Googe Scripts (Google Script).

Download Google Sheets for iOS

Download Google Sheets for Android

Google Scrips sounds complicated and confusing. You may think it involves advanced programming knowledge but it really isn't. This article will introduce you to four simple scripts that help you customize functions, automatically create charts based on any data, customize your menu in Google Sheets, and even automate it. monthly email delivery.

1. Create your own custom functions

Creating custom functionality is one of the easiest ways to create a Google Scripts that can enhance your Google Sheets experience. Google Sheets has provided a long list of available functions. You can view the most popular ones by clicking on the function icon on the menu.

4 scripts to make Google Sheets stronger

Then click on More functions ... to open a list of algorithms, finances, techniques and more. However, Google Scripts gives you the flexibility to create your own personal formulas.
To create your first custom function, you'll first need to open the script editor by clicking Tools> Script Editor.

4 scripts to make Google Sheets stronger

You should see a window appear similar or similar to below.

4 scripts to make Google Sheets stronger

What you need to do is replace what is in this window with your own custom functionality. The function name is the same as the one you will start typing into a cell in Google Sheets after the "=" symbol to call your formula. A function to convert Celsius to Fahrenheit would look like this:

function CSTOFH (input) {
return input * 1.8 + 32;
}

Paste the above functions into the code window and then select File> Save , name the project "CelsiusConverter" and click OK.

That is all you have to do. You start using your new function by typing "=" followed by your function, with the number entered to convert:

4 scripts to make Google Sheets stronger

Hit enter and you will get results.

4 scripts to make Google Sheets stronger

2. Automatically create charts

You can have a new spreadsheet every month with new data and you want to automatically create a new chart without having to recreate it every month. You can do this by creating a function that will create a new chart for you based on the data in the current workbook you have opened.

Suppose you are a teacher and at the end of the year you have a spreadsheet for each student with a list of monthly test scores:

4 scripts to make Google Sheets stronger

What you want to do is run a single function on this table that will automatically generate a chart in seconds. The script will look like this:

function GradeChart () {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet ();
var sheet = spreadsheet.getSheets () [0];

var gradechart = sheet.newChart ()
.setChartType (Charts.ChartType.LINE)
.addRange (sheet.getRange ('A1: B11'))
.setPosition (5, 5, 0, 0)
.build ();

sheet.insertChart (gradechart);
}

All you have to do is open each student's spreadsheet and click the run icon in the menu in Google Scripts to automatically create the chart.

4 scripts to make Google Sheets stronger

Whenever you click the run icon, it will run the script that you created on the "active" spreadsheet (a workbook you have opened in your current browser tab).

4 scripts to make Google Sheets stronger

For reports that you have to create regularly, like weekly or monthly, this type of auto-charting function can really save you a lot of time, because you don't have to recreate from scratch. When you want to import chart data on a new worksheet.

3. Create custom Menu

If you don't want a script to automatically generate charts and want that functionality right at your fingertips on the menu system in Google Sheets, you can make that happen.

To create a custom menu, you need to give the spreadsheet a new menu item every time it opens. You can do this by creating an onOpen () function in the Script Editor window above the Gradechart function you just created.

function onOpen () {
var spreadsheet = SpreadsheetApp.getActive ();
var menuItems = [
{name: 'Create Grade Chart ...', functionName: 'GradeChart'}
];
spreadsheet.addMenu ('Charts', menuItems);
}

Save the code and then reload your spreadsheet. You will discover that a new menu item appears with the name you specify it in your script. Click on the menu and you will see the menu item for that function.

4 scripts to make Google Sheets stronger

Click the menu item and it will run the same functions as it did when you click the run icon from within the Google Scripts editor.

4. Send the report automatically

The last script is a script that will email from within Google Sheets. This can be useful if you are managing a large group of people and you have to send multiple emails on the same subject. You may have performed a performance review with each team member and have recorded your review comments for each person in Google Spreadsheets. It is very convenient and time-saving to just run a single script and the reviews will be automatically sent to 50 or 60 people at the same time without having to create each email and send it individually. That is the power of Google Scripting.

Similar to the way you created the scripts above in this article, you will create a script for automatic report submission by going to the script editor and creating a function called sendEmails () , as follows: :

function sendEmails () {
var sheet = SpreadsheetApp.getActiveSheet ();
var startRow = 2; // First row of data to process
var numRows = 7; // Number of rows to process
var dataRange = sheet.getRange (startRow, 1, numRows, 3)
var data = dataRange.getValues ​​();
for (i in data) {
var row = data [i];
var emailAddress = row [1]; // Second column
var message = row [2]; // Third column
var subject = "My review notes";
MailApp.sendEmail (emailAddress, subject, message);
}
}

So, suppose you have the worksheet organized as shown here.

4 scripts to make Google Sheets stronger

The above script will do everything through each row in the spreadsheet and send an email to the address in the second column with the message you entered in the third column.

The sendEmail function in Google Scripts is one of the most powerful functions in Google Scripts because it opens up a world of email automation that you have never considered before.

If in reality you have someone else responsible for importing data into your Google spreadsheet, and if you automatically deliver emails based on the entered data, you can do something like send a monthly report to Boss, that never really needs to open his customer email. The script can automatically do all the work for you.

All these features of Google Scripts will show you that with just a few simple lines of code, Google Scripts has the right to automate part or all of Google Sheets. These automation can be set to run on schedule or run whenever you want to enable them. Either way, they provide you with a way to automate a lot of work without spending a lot of effort and time.

Sign up and earn $1000 a day ⋙

What should I do if Netflix is ​​hacked?

What should I do if Netflix is ​​hacked?

What should I do if my Netflix account is hacked? What should I do if my Netflix account is hacked? Here's what you need to know when your Netflix account is hacked.

Tips for using LDPlayer you may not know

Tips for using LDPlayer you may not know

Tips for using LDPlayer you may not know. LDPlayer is one of the most popular Android emulators on computers today. This article will provide it to you

Shortcuts in Blender that users need to know

Shortcuts in Blender that users need to know

Shortcuts in Blender that users need to know. Blender shortcuts help you work faster when designing graphics. Therefore, WebTech360 will synthesize the keys for you

Kahoot hacking tips you may not know

Kahoot hacking tips you may not know

Kahoot hacking tips you may not know, how to hack Kahoot to get answers to difficult questions? This article will suggest you some of the simplest Kahoot hacks.

What is Google TasksBoard?

What is Google TasksBoard?

What is Google TasksBoard?, Google TasksBoard is a new task management app, helping you increase work efficiency. Let's learn with Donwload.vn how to use Google TasksBoard

Is Google Takeout a good data backup option?

Is Google Takeout a good data backup option?

Is Google Takeout a good data backup option?, Google Takeout comes from a line of free services from Google. Google says it will help users download it

Host permissions and how to specify co-host in Zoom

Host permissions and how to specify co-host in Zoom

Host rights and how to designate co-host in Zoom. How to regain host rights on Zoom is not difficult. This article will introduce you to host and reclaim host details

6 steps to become a Pinterest expert

6 steps to become a Pinterest expert

6 steps to become a Pinterest expert, Pinterest is a tool for collecting, organizing, and sharing photos and videos you glean from the Internet. Here are 6

3 ways to edit sunsets in Photoshop

3 ways to edit sunsets in Photoshop

3 ways to edit sunset in Photoshop, Sunset is always a scene that every photographer wants to capture. However, taking sunset photos is not easy. Wear

Convert text to speech online

Convert text to speech online

Convert text to speech online. If you want to listen to the pronunciation on Google Translate or Google Translate, users can download this voice to your computer easily.

(2024) The Best Free Cloning Software for Windows 10/11

(2024) The Best Free Cloning Software for Windows 10/11

Are you looking for the free cloning software for Windows 10? This passage will share you the best free Windows 10/11/7 cloning software in 2024.

Steps to create a new database in Access

Steps to create a new database in Access

Steps to create a new database in Access, Steps to create a new database in Microsoft Access are not difficult. This article will guide you in detail on the steps to build muscle

3 ways to save files better on your computer

3 ways to save files better on your computer

3 better ways to save files on your computer, How to save files on your computer is not difficult. However, what is the best way to save on the computer? Let's find out with Dowload.vn

10 poems for the first day of school in 2023 - 2024

10 poems for the first day of school in 2023 - 2024

10 poems for the opening day of school in 2023 - 2024, TOP 10 short and unique poems for the opening day of the new school year. We invite you to follow along!

Things you should do first when buying a Samsung smartphone

Things you should do first when buying a Samsung smartphone

Things you should do first when buying a Samsung smartphone, Samsung phones contain a lot of applications and settings. Here are the settings you should do when

The easiest ways to create borders for photos

The easiest ways to create borders for photos

The easiest ways to create borders for photos, Adding frames to photos is not difficult and you have a lot of options. This article will summarize for you ways to add frames to beautiful photos

Office 2021 vs. Microsoft 365: Which software is right for you?

Office 2021 vs. Microsoft 365: Which software is right for you?

Office 2021 vs. Microsoft 365: Which software is right for you?, Office 2021 and Microsoft 365 can both meet office editing tasks. So Office 2021

Gemini - Googles artificial intelligence model

Gemini - Googles artificial intelligence model

Gemini - Google's artificial intelligence model, Google launches Gemini - an artificial intelligence model competing with OpenAI's GPT-4, this is an artificial intelligence model

What is rendering?

What is rendering?

Rendering is the process of creating an image from a model into a movie scene or image using computer software.

What is CPU? What are the popular CPU types today?

What is CPU? What are the popular CPU types today?

The CPU is the data processing center, or simply understood, it is the brain that controls most of the rest of the components in a computer.