Professional Documents
Culture Documents
Did you know that the suite of products on Google Drive (https://drive.google.com), especially Google
extended by custom scripts? These scripts can dramatically improve your productivity (http://www.ma
If you use a spreadsheet application to crunch data, then custom scripts could be the master key. Sta
Spreadsheet scripts and make use of your data in new ways.
Let's go
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
Before you begin drooling over the following Google Spreadsheet scripts, its important to know how
1. To add a script, youll need to log into Google Drive, go to a spreadsheet, choose Tools Script E
2. Copy and paste the script code, and then click on Save.
3. To run the script, just go to Tools Script Manager and choose the function you want. The nam
name in the first line of the script, i.e. function removeDuplicates() results in the script being called
For all of you scripting and programming nerds, the scripts are written in JavaScript (http://www.make
works/). Google has various resources that describe the API (https://developers.google.com/apps-scr
you need to catch up on your JavaScript, there are plenty of free JavaScript resources (http://www.ma
resources-for-learning-javascript-by-doing/) you can use.
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
Remove Duplicates
If youre working with a large spreadsheet that may have repeat information, it may be advantageous t
(depending on the context of your work). This way, you have a perfect dataset to work with that won
The script code for this is the following:
function removeDuplicates() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
var newData = new Array();
for(i in data){
var row = data[i];
var duplicate = false;
for(j in newData){
if(row.join() == newData[j].join()){
duplicate = true;
}
}
if(!duplicate){
newData.push(row);
}
}
sheet.clearContents();
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
With a bit of research, I am sure that this script can also be tweaked to count the number of times an
entries first and then delete the duplicates.
Did you know that you can also send emails from a spreadsheet? Absolutely! For this specific script, y
message body, but the subject line is fixed. You can change it in the script code, or you can modify th
between the recipient and the message body for a subject. Then, just modify the number of items to b
script code for this is:
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 2; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 2)
// Fetch values for each row in the Range.
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
One of the most useful features of spreadsheets is conditional formatting a custom rule on a per-ce
(such as fill color) depending on the content of the cell. It works well, but it is also limited for single cell
formatting to an entire row, for example, then youll need to use a script.
This here is an example script that should do the job. This script sets the row color depending on the
function setRowColors() {
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
However, note that the script is hard-coded, so youll need to change the test values (the content in th
maybe even add or remove cases as necessary for your spreadsheet.
Conclusion
As you can see, scripts can be extremely useful in Google Spreadsheet. They tend to be very specializ
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/
plan on using one that doesnt come from the Script Gallery, theres a high chance that youll need to
However, Google has plenty of resources and tutorials (https://developers.google.com/apps-script/)
have everything you need to do the job.
That being said, dont be afraid to check out the Script Gallery found under the Tools menu. There a
do a lot for your day to day productivity. Ryan also showed us some amazing Google Spreadsheet fun
http://www.makeuseof.com/tag/boost-productivity-with-these-excellent-google-spreadsheet-scripts/