Hacker News new | past | comments | ask | show | jobs | submit login
How to automate Google related tasks (developers.google.com)
137 points by LOLCAT1024 on April 8, 2018 | hide | past | favorite | 26 comments



Apps Script is honestly pretty terrible simply because the "IDE" you're working in is terrible. There is no integration with any proper IDE or text editor. It's using ES5 iirc when it could easily support more advanced Javascript versions or when it could allow you to use Typescript. I only sometimes use it out of necessity, but it remains a huge pain.


Yeah, the IDE is painful. I think there are ways to expose the script files in drive and edit them outside (possibly even debug in eclipse in a very roundabout way? I might be dreaming). I wish they would integrate with jetbrains (as they've done with android)


There is this: https://developers.google.com/apps-script/guides/clasp

I've not used it and I have a feeling it doesn't really help one take full advantage of their IDE of choice but it might still beat the online editor.


Recently had to use Apps script to count the number of files in a number of Google drives folder, it was pretty annoying.

The Drive API doesn't actually expose that information at all so I had to loop through the files with a counter to get the information I needed, but that was so inefficient that I got timeout errors for anything but the smallest of folders.

Unfortunately I had to resort to their Python API which was totally awful in its own way, but at least I didn't have to worry about timeout errors and could get the job done.

Google apps script is probably good for doing stuff in spreadsheets or documents, but its use as an API across Google's platform really needs some work.


Having used the Spreadsheets API, I can say it's definitely bad, mainly because of its slowness and the small amount of data any query can return. We needed 45 seconds to modify two fields in any given document.


And this is called progress. Sharing files on a central computer system (mainframe), and efficient scripting (e.g. VMS,Unix,etc) was solved in the 70s.


pretty much everything connected with the web is a leap backwards in many ways...not only the programming language and tooling ;)


I use Google Apps Script to archive old, unread emails in a label periodically: https://gist.github.com/saagarjha/d8657a5cee921856186cd12180.... I find this handy to clear out a couple of labels that invariably accumulate a junk; for example, I use this on all my mailing list subscriptions. One thing that's really annoying is that Google Apps Script is really eager to delete log entries for some reason, so the logging message I put for checking progress (when time runs out) doesn't ever show up in the logs because it's always likely that the logs were cleared out before I could read them.

Just for fun, I also have an script to post XKCD to a Slack channel: https://gist.github.com/saagarjha/ea067aff9674e8382c15d3b7de.... It's probably not the intended use, but it's free and runs periodically!


Apps script is very good and powerful, and it's been around since a very long time ago.

It seems they'll try to push it again now.

My problem with "automating Google-related tasks" was always the complexity of their APIs, specially authorization, and the need to use those enourmously complex SDKs they provide. Sometimes I want to just do some curl calls.

In the case of Google Apps Script, perhaps it would've been better if they came up with a coding environment separate from Google Drive.


Their Clasp tool lets you code Apps Script from your own editor:

https://developers.google.com/apps-script/guides/clasp


Whoa, I didn't knew that. It looks great. I'll try it.


Google Sheets + Apps Script + UrlFetchApp[1] is a very powerful API runner enabling you to loop through a set of Google Sheet rows to make API calls.

The unofficial APIs exposed by single-page-apps are pretty easy to reverse engineer, too.

1: https://developers.google.com/apps-script/reference/url-fetc...


Can you give some examples where this combination was more effective than using a standard file and shell/python


When you have to massage, filter, sort, manipulate the data prior. Which for me is almost always the point.


I used Google apps script to make a full invoicing automation system with Zoho CRM, Zoho Invoice, Google Drive, Google's Spreadsheet-to-PDF tool, and Google Cloud Print.

There were a bunch of gotchas in terms of the 6-minute runtime, the available runtime per day, and the script just getting killed randomly.

I managed to work around them all after a lot of hair-pulling... We ran ~15k invoices through it last year!


impressive! Good job. But this hair pulling wants me to say "It's the VBA of Google"


All I want is an API for Google inbox so that I can programmatically make tasks.


To clarify after Bryan very kindly sent me a link to the tasks api [1], what I'm really after is an interface to the "reminders" functionality in Google Inbox (basically tasks-lite)

[1] https://developers.google.com/apps-script/advanced/tasks


Good is slowly becoming Microsoft. Just when we finally have a handle on worms spread through Word and Excel Macros, now we will have Google Doc Macros.It will be interesting to see what kind of security vs usability we will see. Also, with these Google macros, will an abusive macro that spams, get you locked out of your Google account and unable to access your documents?


Google Apps Script has been around since 2009...



I don't see any mention of Apps Script in that blog post.


TLDR: someone linked to all the images of an S3 bucket from google sheets, and Google proxies loading the images through Google (smart security process). The worst thing here may be that google ignored the Cache-Control returned by S3.

Where is the actual security incident?


While you can do what look a lot like (and are called) document macros with this, it's more like a JS PaaS with libraries for Google services than it is like classic MS Office facilities.


making some of the same mistakes that MS made != becoming MS.

But yes I hope they're being careful with this.


MS's issues with macros was my first thought as well.

I'd really like to hear about their plans security wise with this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: