Skip to content

Instantly share code, notes, and snippets.

View palumbo's full-sized avatar

Joseph Palumbo palumbo

View GitHub Profile
@palumbo
palumbo / Code.gs
Last active December 11, 2023 00:39
Create a Notion-Style Life OS Dashboard in Google Sheets
function onOpen() {
randomQuote();
let ui = SpreadsheetApp.getUi();
ui.createMenu("Life OS")
.addItem("New Quote", "randomQuote")
.addItem("New Journal Entry", "dailyJournal")
.addToUi();
@palumbo
palumbo / createFolders.gs
Created August 5, 2023 16:50
This Google Apps Script creates folders and files in Google Drive based on values in Google Sheets
function myFunction() {
// Spreadsheet Variables
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow();
// Google Drive Variables
var rootFolder = DriveApp.getFolderById("1oqHxYeC8wC0ufJ8WPtq4WKfoJDqulppB");
@palumbo
palumbo / payrollElectionSort.gs
Created September 14, 2022 02:30
Sorts payroll election order based on amount and percentage
function myFunction() {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let lastRow = sheet.getLastRow();
for (var i = 1; i < lastRow; i++) {
let check1 = sheet.getRange(i+7,2).getValue(); // GETS FIRST VALUE IN COLUMN B
let check2 = sheet.getRange(i+6,2).getValue(); // GETS SECOND VALUE
if (check1 == check2) {
let amount = sheet.getRange(i+7,33).getValue();
@palumbo
palumbo / Code.gs
Created August 27, 2022 19:45
Checking values against an array to prevent data duplication
function myFunction() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var nameArray = ["Eddie", "Jaime", "Katie", 42];
var inputFromUser = Browser.inputBox('Please enter a value');
Logger.log(inputFromUser);
let checkCell = sheet.getRange("A1");
@palumbo
palumbo / checkAgainstArray.gs
Created August 27, 2022 18:10
Google Apps Script that will take a value from a user and compare it to values stored in an array.
function myFunction() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var nameArray = ["Joseph", "Elizabeth", "Roman", "Sophia"];
// GET VALUE FROM USER
let valueFromUser = Browser.inputBox("Who are you looking for?");
Logger.log(valueFromUser);
@palumbo
palumbo / Download Images.gs
Created June 9, 2022 23:55
The code I used to download images into a Google Sheets cell or download images into a Google Drive folder.
function insertImage() {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let lastRow = sheet.getLastRow();
for (let i = 0; i < lastRow-1; i++) {
let url = sheet.getRange(2+i,1).getValue();
let image = SpreadsheetApp.newCellImage().setSourceUrl(url);
sheet.getRange(2+i,2).setValue(image);
}
@palumbo
palumbo / moveRows.gs
Created May 29, 2022 14:17
Google Apps Script that copies rows to a new sheet based on a cell value.
function onOpen(e) {
let ui = SpreadsheetApp.getUi();
ui.createMenu('🤖 Automation Tools')
.addItem('Move reps to individual sheets', 'moveRows')
.addToUi();
};
function moveRows() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getActiveSheet();
import sys
import requests
import os
from urllib.request import urlopen
from bs4 import BeautifulSoup
# unpack argv
script, url = sys.argv
# get URL
@palumbo
palumbo / wordpress.sh
Last active September 22, 2024 15:25
AWS EC2 Wordpress bootstrap script
#!/bin/bash
yum install httpd php-mysql -y
amazon-linux-extras install -y php7.3
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp -r wordpress/* /var/www/html/
rm -rf wordpress
rm -rf latest.tar.gz
chmod -R 755 wp-content
@palumbo
palumbo / email.gs
Created May 28, 2018 22:25
Code that emails notifications from my Customer Success Tracker made in Google Sheets
function onEdit(e) {
// setting common variables
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var user = Session.getActiveUser();
var cell = sheet.getActiveCell().getA1Notation();
var val = sheet.getActiveCell().getValue();
var range = sheet.getRange("A1:Z182"); // creates range needed to use getCell() later
var url = ss.getUrl();