Even if you think you’re the most efficient and productive person in the world, there is always room for improvement and Google Scripts can help.
Whether you’re looking to improve your scheduling, collaborate better with your team, or receive information and news faster and more efficiently, there’s a Google script out there that can help. Most people avoid using scripting because they don’t feel like they’re programmers — and have no business using Google Scripts.
The truth is that there are many pre-written scripts available for free across the Internet, and even if they don’t do exactly what you want, tweaking them to your needs isn’t quite as hard as you might think.
Three Scripts to Improve Productivity
In this article I’ll give you three scripts that you can add to your own Google Drive account:
- Calendar Events to Email — This script emails you the 10 earliest upcoming events in your calendar
- Form to Email — Use this script to accept form entries directly to your email (like a website contact form)
- Twitter to RSS — Create an automated system that monitors Twitter and adds what you care about to a custom RSS feed
Each of these scripts are based on an existing script on the web. In some cases I’ve tweaked them, but in each case you’ll see a link to the original and instructions on how to perform the same tweaks for yourself.
Send Calendar Events to Email
To use any of these scripts, just go to your Google Scripts account and you can paste your script in there. In this case, get your script from the Listing events section of the Google Developers page.
Once you’ve pasted the sample script from there, click on Resources from the menu in Google Scripts, and then select Advanced Google services…
For this script to work, you need to turn on the Calendar API in this window.
Next, click on the Google Developers Console in the yellow box at the bottom of this window.
On the next window, you’ll see a search field with a whole bunch of links on the page. Just search for “Calendar” and click on the Calendar API link.
On the next window, you’ll just need to click the “Enable API” button to enable the connection between your Google Scripts account and your Google Calendar.
To make this script work, you need your calendar ID. You can get this by going into your Calendar Settings, and choosing the Calendar that you want to receive notifications from.
In this section, scroll down to the Calendar Address section, and here you’ll see your calendar ID.
Copy your calendar ID, and then go back to the script you’ve pasted in your Google Scripts page.
Find the line that starts with “var calendarID =” and paste your ID in place of the one that’s there.
So, at this point the script you’ve just
stolen borrowed from the Google Developers site will send the next 10 events to the Google Script logs.
This is cool and everything, but it doesn’t do you a whole lot of good. Instead, you want to tweak this code to send this list to your email address using the Google Scripts “sendEmail” function. Find the parts of the code that start with “Logger.log(‘%s (%s)’, event.summary….” and comment each of those lines out with a “//” in front of them.
Under those lines, type in a new line as follows:
“html=html + event.summary + “</p><br>;”
Also make sure to define the new variable at the start of your script by adding this line with all of the other variable definitions:
Don’t worry — not much more to go. You’re almost there!
Next, you’ll want to add this small section of script to the very end of the “listNext10Events” function you’ve added to your Google Scripts account.
In the “to” field, type in whatever email address you want your Calendar events to get emailed to. In the “subject” field, type whatever you want so you’ll recognize the incoming email reminders. Finally, make sure the “htmlBody” field is only “html,” and nothing else.
All you have to do now is save your new script and press the play icon. The first time you run it, you’ll have to approve permissions for the script to access your Calendar — go ahead and OK those approvals. You’ll see the incoming events reminder email show up in your email inbox.
That’s all there is to it. Of course, you don’t want to have to manually run your scripts each time, right? Instead, you can set up a trigger to run this script once a day if you like.
You do this by clicking on Resources in the menu, and choosing Current project’s triggers.
Finally, click the Add a new trigger link, choose the “listNext10Events” function, choose “Time-driven” as the event, and then you can choose whether to get events every day, week, month — whatever time interval you choose.
Finally click Save. Now, depending on the time interval set, your script will run and you’ll receive email updates with your next 10 upcoming calendar events!
Send Form Entries to Your Email
Another very useful script comes from the wonderful and ever-popular Amit Agarwal over at Digital Inspirations, where you’ll find a helpful Google Script to send Form data directly to your email.
Your first order of business is to create a Google Form by going to your Google Drive account, clicking New and then selecting Google Forms. If you need a hand with creating Google Forms, we’ve got you covered with plenty of past articles showing you how.
In this example, I’ve created a contact form for my website, asking the reader for a name, email address and a paragraph text field for reader comments.
In the form editor view, click View Responses to open Google Spreadsheets, and then click Tools from the menu and choose Script Editor.
Highlight all the code that you see there, and paste it with the code from Amit’s page linked above. Finally, replace email@example.com in the code with your email address.
Finally, click the Run icon. You’ll need to authorize the script to use email – once you accept the authorization the script will start working.
Now the cool part. Whenever anyone fills out your form and submits it, you’ll instantly get an email with the details.
Think about how powerful this is — if you publish your form to the web, you can embed it on your own website and accept reader comments without paying anything for a contact form service. Or, if you collaborate with a remote team around the world, you can collect information from all of them just by sharing out your form to your team; all their submissions will instantly be delivered to you.
Can you think of any other cool ways to use this awesome form-to-email script?
Twitter to RSS Feeds
If you find yourself spending a lot of time following different people or searching specific hashtags on Twitter, then you’re really going to love this time-saving script.
This is yet another awesome script from Amit Agarwal that’ll take any feed widget you set up in Twitter and deliver that to an RSS feed that you can load up in your favorite feed reader.
Your first step is to set up a widget in Twitter. Go to your Twitter Profile Settings area, and click on Widgets in the side menu.
Here, you can configure a widget that’ll filter Tweets via search parameters that you set. For example, to set up a widget that’ll provide a stream of Tweets made using the #smarthome hashtag, I’ll set up a widget with a Search Query of #smarthome, as shown here.
Once you have your widget set up, look through the embed code provided in the configuration screen and extract the Widget ID. You’re going to need it.
It’s time to set up the script. Go back into your Google Scripts account, copy the Twitter RSS Feeds script, and paste it into your account. The function is called Twitter_RSS(). Scroll through the script over to the section that starts with “widgetID=e.queryString?e.querySTring”, and change the code in the script to your own Widget ID you’ve recorded above.
Now just change the selected code to “Twitter_RSS” and press the run button in the menu.
You’ll need to give the function permission to run on demand (whenever the Twitter widget updates).
Once that’s done, next click on the Publish menu and choose Deploy as web app… from the dropdown.
A pop-up screen will allow you to configure how this web app gets deployed. Make sure to set “Who has access to the app” to “Anyone, even anonymous”.
Make note of the URL provided once you deploy your web app! This is the URL of your new RSS feed. Now that your new web app is deployed, every time the Twitter stream you configured gets updated, your new RSS feed will get updated.
You can view your feed using your favorite feed reader.
The feed reader script alone is one of the best time-saver scripts of all. No more scouring through Twitter feeds every day and no more sifting through endless Twitter posts for interesting news you care about. Just set up your Twitter widgets, and add the code to create your feed for each one.
Automate Today with Google Scripts
As you can see, it’s possible to do all kinds of really cool automations with Google Scripts, and you don’t even have to create them from scratch. There are fantastic scripts available all around the web — some you’ll need to tweak for your needs, and others you won’t.
Do you know of any cool scripts that boost your productivity in a big way? Share your own tips and what scripts you use in the comments section below!