Google Sheets – replace filter with vlookup for array formula

Cor blimey, this one was a toughy to get to the bottom of! No amount of googling brought me the solution I needed, however by combining resources from three/four places I finally got there.

http://chandoo.org/wp/2014/10/28/multi-condition-vlookup/

http://codingisforlosers.com/learn-vlookup-formula-google-sheets/

https://stackoverflow.com/questions/22260953/google-spreadsheet-vlookup-with-arrayformula-plus-multiplication-of-returned-val

https://productforums.google.com/forum/#!searchin/docs/parallel$20lookup$20solution/docs/36A0epDlIdE

Now the filter function in Google Sheets is a lovely thing, but it doesn’t play nicely if you want an array formula, that is a formula that automagically fills down as you add more data to a sheet. So you have to convert over to using vlookup (or other method) to get the result you want. Now on the face of it vlookup will only handle one criteria, but it can be forced, with a fair bit of jiggery pokery to handle multiple criteria, and then work as an array formula.

Here was the problem. Continue reading

Incron gotchas

Of which there are three:

  1. Make life simple and do all your incron as root. I know you shouldn’t but it helps to avoid all sorts of permissions issues. You may need to create an allow file “/etc/incron.allow” and put either root or your sudo name in it.
  2. Ensure that you only have one “SPACE” (not a TAB) between the three elements on an incron job: e.g.

    /etc/samba/smb.conf IN_MODIFY /etc/init.d/samba restart

  3. incron, like cron, requires full paths for just about everything, so if you are calling a script, use the full path to it, and use the full path to all programs inside the script.

Google Sites (Classic) – Embed Live (working) Google Sheet “Range”

This one has been annoying me for a while but I finally arrived at a solution. It is especially usefeul when working inside a G Suite domain, and you wish to share information on a spreadsheet with some selectable cells (e.g. with drop downs) via a classic googlesites page, so for people with the right permissions they can use the functionality of the sheet without causing damage to the underlying data.

The default options and gadgets for presenting a spreadsheet offer too much of the sheet for my liking.

The way to sort this out is to create a web App that can be displayed on the page. The apps script is created on the website (Manage Site > Apps Script), and once the two parts are created inside a project, the app can be deployed and will then show up when added to you page.

So here is what you need to put in your code.gs Continue reading

GAS – Send Event to Calendar from Spreadsheet

Managing a Google Calendar from a spreadsheet is fairly straight-forward.
You do need the calendar ID and all your ducks lined up on the sheet.

in it’s simplest form:

Continue reading

GAS – Send an html Email

Much the same as sending a normal email, but this time you include a body with html tags:

GAS – Get the Last Row

Use this function to get the last row in Column A of a spreadsheet

If you want the first empty row, simply add 1 to ct:

Imagemagick – Tips and Tricks No. 3

Add a Label to a set of images

First bash script coming up, I’ll explain the best I can: I have a set of images that are all square: w=h. I want to create an image of each image with a label on top,using the filename as the label (without the extension), with a white background, ending up with a 200×250 image with the same name as the original but with “-tab” added. IM will by default squeeze the font size so that the text label always fits. Continue reading

Imagemagick – Tips and Tricks No. 2

Montage

The ability to combine a set of images into one image in a variety of ways, essentially replicates the contact sheets of old. Here are a few ways to create a montage. It works best when all the images are the same height and width. IM does not understand page sizes, and will just create a simple image, regardless of the number of images, you can tell IM which images to use though. It also makes sense when testing and creating montages to save the output to a different directory, otherwise your montages will be included in the next iteration! Continue reading