Hacking Together an Auto-Tweeting Spreadsheet

A while back, I had looked at automating tweets from a Google spreadsheet to reduce the insane number of clicks it takes to do in TweetDeck and HootSuite (5 clicks? Really?) I hit some roadblocks and let it slide because in the long run, it wasn't really important to me. More of a fun experiment.

I jumped back into it a week or so back to try and solve the last little problems. I was able to create a script which loops through a spreadsheet checks the current date and whether or not the tweet has been sent. If those conditions are met (TODAY and NOT SENT), it will automatically post the tweet.

The sheet, like all the other Twitter sheets I've used, is run with Martin Hawksey's fantastic TwtrService library. It allows you to authenticate and tweet right from Google Apps Script and saves a ton of time.

I ran into a problem that is as-yet unsolved: I can't get the sheet to stop after posting one tweet. So, if you have multiple tweets on a given day, it will send all of them at once. That's not good, especially if you're promoting an event over a period of time. I've tried a number of solutions, but I can't seem to find one that works. I'd love to hear if you're able to take the source and tweak it to work.

In the meantime, Martin also took a (much more elegant) pass at the task. His sheet is also available and works really well. The goal is the same, but his mechanics and implementation are much more refined and effective.

It's a good example of multiple ways to skin a cat. I'm a novice coder (I tell people I know enough to break something) and he's an expert doing all kinds of things. The great thing is, all of this code is open and available. I can make a copy of Martin's page and dig into his solution. I learned a few tricks about checking for multiple conditions, which is what I was struggling with. I became better at scripting through my failure and his success.

Leave a Reply

Your email address will not be published. Required fields are marked *