Profile cover photo
Profile photo
Thomas Mills Hinkle
100 followers
100 followers
About
Posts

Hey all -- I have some old python code I was going to migrate into GAS for convenience that we use to automate creation of google sites.

The one thing I can't seem to do right now is set domain level permissions.

My python code looks like this:

def make_domain_readable (entry):
print 'Make domain-readable'
role = gdata.acl.data.AclRole(value='reader')
scope = gdata.acl.data.AclScope(value='innovationcharter.org',type='domain')
domain_acl = gdata.sites.data.AclEntry(scope=scope,role=role)
client.Post(domain_acl,entry.FindAclLink())

Is there no way to do the equivalent in Google Apps Script? I'm used to a two-tiered API from google, but I'm not finding any way to turn on an advanced API to give me more access to the old sites.

+Andrew Stillman, any help? Did you guys handle this in your old sites add-ons?

Or maybe I'll just have to keep this one piece of the onboarding cycle in a python script on my machine...

Tom

Post has attachment
I've had a weird bug with web apps not scrolling properly. When you load a page, it doesn't scroll until you re-size the page (or flip between portrait and landscape and back if on a mobile device).

Today, I finally narrowed in on the culprit, which is using rotating spinners in my code. If I have a spinner in my webpage served as a google web app, the scrolling bug shows up. If I remove the css rotation code, it goes away.

Here's a minimal test case with the bug in action: https://script.google.com/macros/s/AKfycbzFnMIk_1v0YDJkrpGV9MwsEvAnyA3bWP8DoApc1vLCR-en8N-i/exec

Here is the bug all fixed up, with the rotation replaced with flashing and no problem: https://script.google.com/macros/s/AKfycbxlodeyoy4LEyoALN9U-KaNAkJe5KfKIZqQ2gCTiOOJHpHTMXpv/exec

Has anyone else seen this? Do you know where to report this kind of issue under issue tracker?

Post has attachment
So I can't believe I've never run into this before, but I've just realized that objects with numeric keys do not behave properly when passed as arguments back to google apps script via google.script.run

Specifically, if you call e.g. google.script.run.someFunction({42:'meaning of life'})

You will find that on the other side...

function someFunction (obj) {
obj[42] ==> evaluates to undefined ?!?!?!
}

I haven't come up with a very good workaround. I'm sure this must come up a fair amount, as surely you often have user-structured data moving back and forth across apps script.

Here's a quick demo (run the TEST CASE menu code) https://docs.google.com/spreadsheets/d/191EVXoiTI1UyUjxluH9ZVvVFBypz0XXd4wdQNvB-Rdo/edit#gid=0

Has anyone published a docs or sheets add-on that worked in concert with a web app? Is that allowed? Can you publish both from the same code base?

I have two plug-ins in mind, one simple (test case) and the other complex.

My simple test case plug-in is something I use for grocery lists. It just takes a list in a google doc and presents a checklist UI. I use the web add-on to create a simple mobile interface (you paste a link to the website view of the google doc -- it's the very same view that you'd get in a modal window on a computer, but you can't serve up a modal window to the phone version of docs, so you plop a link into the document that launches the web browser instead).

My real reason for wanting to do this is to create a more complex add-on that needs to set up multiple triggers. I actually built out the entire add on only to realize that I can't create the triggers I want to when running it as an add-on, so what I'd like to do is basically just push the trigger part of the code into a web app.

Let me know if you'd been down this path before.

Thanks!

Does anyone have experience using custom formulas that operate on arrays + filter views in google? I'm having an issue where a custom formula that works fine when looking at a sheet normally is failing when I enable filter view. For the use case in question, filter views are essential to my work. Am I right in thinking that a custom formula that operates on an array should work the same whether a filter is turned on or off (or whether a filter view is on or off?)?

Here's a test case -
if you play with sorting and filtering, you'll see the "Rank" column autopopulates correctly, but if you move to one of the filter views, it will fail. https://docs.google.com/spreadsheets/d/1s6G_TEm0_j5my1w6lEG9jgmL2w-LXzVbyl4gL1XjC7U/edit#gid=0

Here's the error report I filed: https://issuetracker.google.com/issues/37755919

Post has attachment
Does anyone have experience using custom formulas that operate on arrays + filter views in google? I'm having an issue where a custom formula that works fine when looking at a sheet normally is failing when I enable filter view. For the use case in question, filter views are essential to my work. Am I right in thinking that a custom formula that operates on an array should work the same whether a filter is turned on or off (or whether a filter view is on or off?)?

Here's a test case -
if you play with sorting and filtering, you'll see the "Rank" column autopopulates correctly, but if you move to one of the filter views, it will fail. https://docs.google.com/spreadsheets/d/1s6G_TEm0_j5my1w6lEG9jgmL2w-LXzVbyl4gL1XjC7U/edit#gid=0

Here's the error report I filed: https://issuetracker.google.com/issues/37755919

Post has attachment
Try out my new chrome extension for keeping track of tabs across multiple windows https://chrome.google.com/webstore/detail/all-the-things/jaiigpjhekljjilaclkeeaadffkekaal

I could find lots of extensions that show you all the tabs in your current window, but none that made it easy to see where everything was -- and for someone who spreads out across windows in multiple desktops, I often found I spent too much time digging for a tab I had open, or re-opening tabs I'd already opened more than once.

My extension overrides the default chrome new tab, so every time you open a new window or new tab you start off by seeing everything you've already got open. If you choose to navigate to an already-open tab instead of opening a new one, it will close the new tab you'e just opened.

This is still pretty beta but I'm already relying on it for everyday use happily. There is occasional bugginess with the drag and drop code that lets you reorganize windows and tabs, but I think it's worth living with for the time being, and I still haven't actually hit on the set of steps to reproduce the bug so I haven't yet been able to track it down and fix.

I'm running into trigger limitations in an add-on I'm writing and wondering how others deal with similar problems.

My add-on manages workflows, with a spreadsheet containing the configuration data/logic for various steps of a workflow that moves through several forms. When testing by hand, I can generate all the appropriate triggers for different forms, but when I test it as an add-on, I'm not allowed to set up form triggers from the spreadsheet (I get the error "This Add-on is attempting to create a trigger on a document that it is not currently being used in.").

After re-reading the trigger docs, it looks like add-ons are limited to one trigger per type per document anyway, so my add-on could never work.

If I make this into a standalone web app, though, am I right in thinking I would then be allowed to create all the triggers I want? If so, is there anything preventing me from basically having my add-on point to a web-app to manage the triggers? Any advice on how to make this process less confusing to users? The reason I was going w/ an add-on over a web-app in the first place is that the path to installation and use is more straightforward for the enduser.

Dumb question I can't seem to solve with google -- does anyone know how to properly escape spaces in an orgUnitPath? I'm trying to add users to the right orgUnit via script and I keep getting INVALID_OU -- our OrgUnit names have spaces in them... e.g. /Middle School/Class of 2024/

Alternatively, if I could feed the orgUnit ID to Users.insert in the AdminSDK, that could work too, but that doesn't seem to be one of the params you can pass in.

So I did too much testing today and ran into the error: "Service using too much computer time for one day"

My understanding is this is a limitation per trigger. Does that mean it's per script? Per script per trigger? Per form per trigger? Just trying to figure out if there's a good way to work around it for testing triggers.

I could imagine making a new copy of the script, a new copy of the form, etc., but don't want to waste the time if it won't help.

I don't believe I'm going to actually run into this error in production given our use cases, but I was a little careless with some of the tests I ran and ended up triggering it a bunch more than I needed to.
Wait while more posts are being loaded