This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** this script will not run correctly until imageFolderId is correctly set | |
*/ | |
var imageFolderId = "REPLACEWITHYOURGOOGLEDRIVEFOLDERID"; | |
var imageFolder = DriveApp.getFolderById(imageFolderId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This script generates a google doc from multiple 'child' docs. | |
It is meant to be triggered from an AppSheet.com app vis a vis a Google Sheet, e.g.: | |
AppSheet adds record/event to Google Sheet >> Trigger listening to Google Sheet >> This script invoked | |
*/ | |
// the Google Sheet that is to be queried |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is hard wired to the folder ID of a google drive folder which stores file uploads | |
// from appsheet dot com. We retrieve the Google ID from the upload and then insert | |
// that ID back into a separate column. | |
function onChange(e) { | |
// hardwired the file upload folder, pls make better | |
var folder = DriveApp.getFolderById("APPSHEET FOLDER ID WHERE YOUR UPLOADS ARE GOING"); | |
var sSht = e.source; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onChange(e) { | |
var sSht = e.source; | |
var sht = sSht.getActiveSheet(); | |
var shtName = sht.getName(); | |
var activeRng = sht.getActiveRange(); | |
var activeRow = activeRng.getRow(); | |
var image = sht.getRange(activeRow,4).getValue(); | |
var folder = DriveApp.getFolderById("APPSHEET FOLDER ID WHERE IMAGES WERE UPLOADED"); | |
var blob = folder.getFilesByName(image.split("/")[1]).next().getBlob(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This script generates a google doc from multiple 'parent/child' records. | |
It is meant to be triggered from an AppSheet.com app vis a vis a Google Sheet, e.g.: | |
1. AppSheet adds record/event to Google Sheet >> | |
2. Trigger listening to Google Sheet >> | |
3. This script invoked | |
4. your shiny google doc is generated from a parent/child appsheet app | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func timeAgoSinceDate(_ date:Date, numericDates:Bool) -> String { | |
let calendar = Calendar.current | |
let now = Date() | |
let earliest = (now as NSDate).earlierDate(date) | |
let latest = (earliest == now) ? date : now | |
let components:DateComponents = (calendar as NSCalendar).components([NSCalendar.Unit.minute , NSCalendar.Unit.hour , NSCalendar.Unit.day , NSCalendar.Unit.weekOfYear , NSCalendar.Unit.month , NSCalendar.Unit.year , NSCalendar.Unit.second], from: earliest, to: latest, options: NSCalendar.Options()) | |
if (components.year! >= 2) { | |
return "\(components.year!) years ago" | |
} else if (components.year! >= 1){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
OVERVIEW: | |
Apps Script which, when triggered on a Google Sheet row, | |
finds the image content referenced and | |
creates a checksum/digest string for that content and | |
inserts that string back into the Google Sheet | |
BACKGROUND: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Collection of apps script functions that trigger G Suite administrative calls | |
good backgrounder: | |
https://stackoverflow.com/questions/60960260/google-scripts-api-call-to-directory-members-failed-with-error-resource-not-fou | |
Appsheet companion app for this solution: | |
https://www.appsheet.com/samples/An-app-to-manage-G-Suite-users-and-group-Meant-to-be-used-in-conjunction-with-a-provided-Google-App-Script?appGuidString=7ab88075-a91c-4898-8a4f-1ca6ce2fca93 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import awswrangler as wr | |
import requests | |
import time | |
import datetime | |
import io | |
import pandas | |
import boto3 | |
import base64 | |
from botocore.exceptions import ClientError | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ast import Try | |
import datetime | |
import os | |
import re | |
import snowflake.connector | |
# import sqlparsing | |
import time | |
import sys |
OlderNewer