Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

View GitHub Profile
@tyrann0us
tyrann0us / Code.gs
Last active December 13, 2024 19:45
Generate a free/busy ICS file from your Google Calendar using this Google Apps Script, which securely saves the file to your Google Drive. Share your availability without exposing event details. All data processing and storage occur within your Google account.
/**
* Generates an ICS file containing free/busy information from your Google Calendar
* and saves it to Google Drive.
*/
function generateICS() {
// Configuration
var calendarId = 'primary'; // Calendar ID to read events from
var fileName = 'busy.ics'; // Name of the ICS file to be saved in Google Drive
var eventTitle = 'Busy'; // Title for the events in the ICS file
var organizationName = 'Acme Corporation'; // Name for the PRODID property
/**
* A number of global variables that are re-used throughout this script.
*/
// 5 minute maximum runtime
var maxRuntime = 5 * 60 * 1000;
var ss = SpreadsheetApp.getActiveSpreadsheet();
We can't make this file beautiful and searchable because it's too large.
id,name,summary,neighbourhood
958,"Bright, Modern Garden Unit - 1BR/1B",New update: the house next door is under construction and there is the possibility of noise from 7am - 5pm. Our rates are discounted during this time period. Our bright garden unit overlooks a grassy backyard area with fruit trees and native plants. It is an oasis in a big city. The apartment comfortably fits a couple or small family. It is located on a cul de sac street that ends at lovely Duboce Park.,Duboce Triangle
3850,Charming room for two,"Your own private room plus access to a shared bathroom across the hall. House is on a big hill with a great view. Plenty of 72-hour free parking in front. Free maps, breakfast food and advice about what to do in San Francisco. As part of the booking procedure, my house rules require you send me this sentence via the Airbnb message thread: ""Kevin, I have read your listing and house rules carefully and I agree to follow what you wrote."" If you don't, you forfeit your reservation and money.",Inner
# takes a csv export of the google sheet as input and tries to download pastebins
#
# usage:
# download_pastebins.py <prefix> <name column> <url column> <csv file>
#
# example:
# download_pastebins.py mt18 1 5 "MT18 Draw List - Played Games.csv"
import sys, os, re, urllib.request, csv
@thisjt
thisjt / Google Drive File Uploader.js
Created June 29, 2023 21:05
Function to Upload a (Zip) File to Google Drive
const keys = require('./auth.json')
const fs = require('fs')
const {JWT} = require('google-auth-library')
const {drive} = require('googleapis/build/src/apis/drive')
// DELETE ALL FILES in "apis" folder except "drive" to slim down "googleapis" file size
function uploadFileToGdrive() {
const auth = new JWT({
@mhawksey
mhawksey / Method1.gs
Created February 17, 2023 09:07
Google Apps Script methods for generating Google My Drive report.
// @OnlyCurrentDoc
const FOLDER_ID = 'YOUR_FOLDER_ID'; // OR 'root' if you want your entire My Drive
/**
* Method One: Using built-in DriveApp / file iterator
*/
function generateFolderFilesDriveApp() {
try {
const folderId = FOLDER_ID;
const parentFolder = (folderId === 'root') ? DriveApp.getRootFolder() : DriveApp.getFolderById(folderId);
@Eun
Eun / Code.gs
Last active June 14, 2024 17:21
simple google apps script router that routes based on `path` url query
const router = Router();
router.Method("GET", "/", function(req, vars) {
return {"status": "ok"};
});
router.Method("GET", "/?<id>[A-Za-z0-9]+)", function(req, vars) {
return {"status": "ok", "id": vars.id};
});
router.Method("POST", "/", function(req, vars) {
@khanhkhuu
khanhkhuu / extractDataFromPdf.js
Created December 9, 2022 04:02
Extract Table From PDF
function test() {
const data = extractDataFromPdf('1jVppnsxpiK56RY7vVFMkTa1_GV8SCWxo');
console.log(data);
}
function extractDataFromPdf(pdfId) {
const PDF_LANGUAGE = 'th';
const pdfFile = DriveApp.getFileById(pdfId);
const { id } = Drive.Files.insert(
{
@tanaikech
tanaikech / submit.md
Created September 14, 2022 05:52
Full-text search of Google Apps Script Projects using Google Apps Script

Full-text search of Google Apps Script Projects using Google Apps Script

These are sample scripts for achieving the full-text search of Google Apps Script projects using Google Apps Script. I have the case that I want to search a value from Google Apps Script projects using a Google Apps Script. In this post, I would like to introduce the sample scripts for achieving the full-text search of Google Apps Script projects.

1. Full-text search from all Google Apps Script Projects of standalone type in Google Drive

Before you use this script, please enable Drive API at Advanced Google services. In the case of the Google Apps Script projects of the standalone type, the full-text search can be achieved using Drive API as follows.

@fady-nasser
fady-nasser / google-calendar-api-example.markdown
Created August 27, 2022 07:18
Google Calendar API Example