GoogleSheets best code I've tested in Google Sheets (forker comment: Just forked to have a static version. If I had upgrades I'll commit them to original repo.)