Google Sheets Programming With Google Apps Script (2015 Revision Complete)
Google Sheets Programming With Google Apps Script (2015 Revision Complete)
Your Guide To Building Spreadsheet Applications In The Cloud
About the Book
All those who buy this version and those who have bought it already will get future updates and additions for free (2015 revision is complete).
Google Spreadsheets and Google Apps Scripts (GAS) are both evolving rapidly so I want to ensure that the material presented here remains up-to-date and continues to improve. Please email me details of any errors you find or with any suggestions you have for new material.
This book provides a resource for all those wishing to develop spreadsheet applications in Google Spreadsheets. The book grew out of a blog that I have been writing since early 2011 see blog site. However, it aims to be much more comprehensive than the blog. The blog gave me a good idea of what material is of most interest to readers, thereby allowing me to concentrate on these topics. It covers the Google Apps Script sub-set of JavaScript as it applies to Google Spreadsheets. As the reader progresses through the book, they will learn how to:
- Write user-defined spreadsheet functions.
- Manipulate the key Google API objects.
- Build user interfaces.
- Interact with other Google applications and services.
- Use a MySQL database running in the Cloud as a back-end data store.
Throughout there is an emphasis on practical applications.
It provides well documented code examples that can be cut-and-pasted and then modified to suit the reader's needs.
There is also an appendix for experienced Excel VBA users that shows common spreadsheet coding techniques in both VBA and Google Apps Script.
All the example code in this book is available for download as a single file at https://github.com/Rotifer/GoogleSpreadsheetProgramming_2015
Please send any feedback/queries/correction/requests for clarification to:
mick@javascript-spreadsheet-programming.com
Table of Contents
-
Chapter 1: Introduction
- 1.1 Google Sheets
- 1.2 Google Apps Script (GAS)
- 1.3 JavaScript or Google Apps Script?
- 1.4 Summary Of Topics Covered
- 1.5 Software Requirements For This Book
- 1.6 Intended Readership
- 1.7 Book Code Available On GitHub
- 1.8 My Blog On Google Spreadsheet Programming
- 1.8 Guideline On Using This Book
- 1.9 2015 Update Notes
-
Chapter 2: Getting Started
- 2.1 Introduction
- 2.2 Google Apps Script Examples
- 2.2 Executing Code – One Function At A Time
- 2.3 Summary
-
Chapter 3: User-Defined Functions
- 3.1 Introduction
- 3.2 Built-in Versus User-Defined Functions
- 3.3 Why Write User-Defined Functions
- 3.4 What User-Defined Functions Cannot Do
- 3.5 Introducing JavaScript Functions
- 3.6 User-Defined Functions Versus JavaScript Functions
- 3.7 Using JSDoc To Document Functions
- 3.8 Checking Input And Throwing Errors
- 3.9 Encapsulating A Complex Calculation
- 3.10 Numeric Calculations
- 3.11 Date Functions
- 3.12 Text Functions
- 3.13 Using JavaScript Built-In Object Methods
- 3.14 Using A Function Callback
- 3.15 Extracting Useful Information About The Spreadsheet
- 3.16 Using Google Services
- 3.18 Summary
-
Chapter 4: Spreadsheets and Sheets
- 4.1 A Note On Nomenclature
- 4.2 Native And Host Objects
- 4.3 A Note On Method Overloading In Google Apps Script
- 4.5 Object Hierarchies
- 4.6 SpreadsheetApp
- 4.7 The Spreadsheet Object
- 4.8 The Sheet Object
- 4.9 Practical Examples Using Spreadsheet And Sheet Objects
- 4.10 Summary
-
Chapter 5: The Range Object
- 5.1 Introduction
- 5.2 Range Objects Are Complex
- 5.3 Creating A Range Object
- 5.4 Getting And Setting Range Properties
- 5.5 The Range offset() Method
- 5.6 The Sheet Data Range
- 5.7 Transferring Values Between JavaScript Arrays And Ranges
- 5.8 Named Ranges
- 5.9 Practical Examples
- 5.11 Concluding Remarks
- 5.12 Summary
-
Chapter 6: MySQL And JDBC
- 6.1 Introduction
- 6.2 What Is JDBC?
- 6.3 MySQL Preliminaries
- 6.4 Connecting to a Cloud MySQL Database from the mysql Client
- 6.5 An Overview of JDBC
- 6.6 Note on Code Examples
- 6.7 Connecting to the Database
- 6.8 Create, Load, Query, Update and Delete a Database Table
- 6.9 Prepared Statements
- 6.10 Transactions
- 6.11 Database Metadata
- 6.12 A Practical GAS Example
- 6.13 Summary
-
Chapter 7: User Interfaces - Menus and Forms
- 7.1 Introduction
- 7.2 Adding A Menu
- 7.3 Building Forms With HtmlService
- 7.3.3 Defining Form Layout in CSS
- 7.4 Transferring Data from Google Sheets To an HtmlService Web Application
- 7.5 Create Professional-looking Forms the Easy Way - Use Bootstrap
- 7.6 Summary
-
Chapter 8: Google Drive, Folders, Files, And Permissions
- 8.1 Introduction
- 8.2 List Google Drive File And Folder Names
- 8.3 Creating And Removing Files And Folders
- 8.4 Adding Files To And Removing Files From Folders
- 8.5 File And Folder Permissions
- 8.6 Practical Examples
- 8.7 Summary
-
Chapter 9: Email and Calendars
- 9.1 Introduction
- 9.2 Sending An Email Using MailApp
- 9.3 Sending An Email With An Attachment Using MailApp
- 9.4 GmailApp
- 9.5 Calendars
- 9.6 Summary
-
Appendix A: Excel VBA And Google Apps Script Comparison
- Introduction
- Spreadsheets and Sheets
- Ranges
-
Appendix B: Final Notes
- Additional Resources
- JSLint
- Getting Source code For This Book From Github
- Blog Updates
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Do Well. Do Good.
Authors have earned$11,597,977writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
C++20 - The Complete Guide
Nicolai M. JosuttisAll new language and library features of C++20 (for those who know previous C++ versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
Jetpack Compose internals
Jorge CastilloJetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
SignalR on .NET 6 - the Complete Guide
Fiodar SazanavetsLearn everything there is to learn about SignalR and how to integrate it with the latest .NET 6 and C# 10 features. Learn how to connect any type of client to SignalR, including plain WebSocket client. Learn how to build interactive applications that can communicate with each other in real time without making excessive calls.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
Functional event-driven architecture: Powered by Scala 3
Gabriel VolpeExplore the event-driven architecture (EDA) in a purely functional way, mainly powered by Fs2 streams in Scala 3!
Leverage your functional programming skills by designing and writing stateless microservices that scale, powered by stateful message brokers.
The easiest way to learn design patterns
Fiodar SazanavetsLearn design patterns in the easiest way possible. You will no longer have to brute-force your way through each one of them while trying to figure out how it works. The book provides a unique methodology that will make your understanding of design patterns stick. It can also be used as a reference book where you can find design patterns in seconds.
Cronache di Domain-Driven Design
Francesco Strazzullo, Matteo Baglini, Gianluca Padovani, Emanuele DelBono, Marco Consolaro, Alessandro Colla, Uberto Barbini, Alberto Acerbis, Julie Camosseto, DDD Open, and Alberto BrandoliniCronache di Domain-Driven Design: un libro corale in italiano fatto di storie indipendenti tra loro, che sono il risultato dell’applicazione di Domain-Driven Design su progetti reali.
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
CCIE Service Provider Version 4 Written and Lab Exam Comprehensive Guide
Nicholas RussoThe service provider landscape has changed rapidly over the past several years. Networking vendors are continuing to propose new standards, techniques, and procedures for overcoming new challenges while concurrently reducing costs and delivering new services. Cisco has recently updated the CCIE Service Provider track to reflect these changes; this book represents the author's personal journey in achieving that certification.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #3
All the Books of The Medical Futurist
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon... - #4
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #6
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #7
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #9
Retromat eBook Bundle for Agile Retrospectives
2 Books
If you facilitate retrospectives this bundle is for you: "Plans for Retrospectives" helps beginners learn the lay of the land with tried-and-true plans. Once you know your way around, "Run great agile retrospectives" contains all 135+ activities in Retromat for you to mix and match.