Skip to content

Instantly share code, notes, and snippets.

@SIFAR786
SIFAR786 / email-drafter.js
Created September 16, 2019 09:10 — forked from katydecorah/email-drafter.js
Draft emails in Gmail from a Google spreadsheet and a Google doc template: https://katydecorah.com/code/google-sheets-to-gmail-template/
// What is the Google Document ID for your email template?
var googleDocId = "abcd0000abcd0000abcd0000abcd0000";
// Which column has the email address? Enter the column row header exactly.
var emailField = 'Email';
// What is the subject line?
var emailSubject = 'You\'re bringing {Type}!';
// Which column is the indicator for email drafted? Enter the column row header exactly.
var emailStatus = 'Date drafted';
/* ----------------------------------- */
@SIFAR786
SIFAR786 / Shorty.gs
Created September 26, 2018 17:30 — forked from marksharrison/Shorty.gs
Google Sheets apps script for Goo.gl URL Shortener & Simple Analytics
//Goog.gl Shortener API - https://developers.google.com/url-shortener/v1/
//Requires URL Shortener API to be enable in Resources > Advanced Google Services of Script Editor
//Requires cFlatten reference "MqxKdBrlw18FDd-X5zQLd7yz3TLx7pV4j" in Resources > Lirbraries... of Script Editor - http://goo.gl/U4v9q2
function onOpen() {
SpreadsheetApp.getUi()
.createMenu("Goo.gl")
.addItem("Shorten Selected URL(s)","setURLShorts")
.addItem("Fetch Selected URL(s) Analytics","getURLAnalytics")
.addToUi()
@SIFAR786
SIFAR786 / find-cell-value-and-delete-row.js
Created July 25, 2018 18:25 — forked from dDondero/find-cell-value-and-delete-row.js
Google Apps script function to delete rows based on value in cell.
function deleteRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
var rowsDeleted = 0;
for (var i = 0; i <= numRows - 1; i++) {
var row = values[i];
if (row[0] == 'delete' || row[0] == '') { // This searches all cells in columns A (change to row[1] for columns B and so on) and deletes row if cell is empty or has value 'delete'.
@SIFAR786
SIFAR786 / submit.md
Created July 18, 2018 15:58 — forked from tanaikech/submit.md
Pseudo Browser with Google Spreadsheet

Pseudo Browser with Google Spreadsheet

Overview

This is a sample script for creating the pseudo browser using Google Spreadsheet.

Description

I unexpectedly noticed this. I think that this is for off-line browsing using HTML data. So there are many limitations. At first, please confirm them.

  • Limitations
  • It cannot move from opened site to other outside site. If the outer site is opened as a new wind, your own browser is opened and move there.
@SIFAR786
SIFAR786 / gist:cb212f4edaa2994023d946886e773f85
Created July 17, 2018 11:18 — forked from roblg/gist:2400902
retrieving a basic auth-protected CSV with Google Spreadsheets and Google App Scripting
// this function assumes the CSV has no fields with commas,
// and strips out all the double quotes
function parseCsvResponse(csvString) {
var retArray = [];
var strLines = csvString.split(/\n/g);
var strLineLen = strLines.length;
for (var i = 0; i &lt; strLineLen; i++) {
var line = strLines[i];
if (line != '') {
@SIFAR786
SIFAR786 / SimpleSalesforceConnection.js
Created July 17, 2018 10:03 — forked from stomita/SimpleSalesforceConnection.js
A Google Apps Script, which simply connects and fetches data from Salesforce RESTful API with OAuth authentication.
/**
* Connect and fetch Salesforce data via OAuth
*/
function queryDataFromSalesforce() {
// Read OAuth consumer key / secret of this client app from script properties,
// which can be issued from Salesforce's remote access setting in advance.
var sfConsumerKey = ScriptProperties.getProperty("sfConsumerKey");
var sfConsumerSecret = ScriptProperties.getProperty("sfConsumerSecret");
if (!sfConsumerKey || !sfConsumerSecret) {
Browser.msgBox("Register Salesforce OAuth Consumer Key and Secret in Script Properties");
@SIFAR786
SIFAR786 / RosterMaker.gs
Created June 4, 2018 00:37 — forked from rheajt/RosterMaker.gs
google apps script to create multiple sections programmatically from a spreadsheet
function rosterMaker() {
//spreadsheet id of the rosters
var SHEET_ID = FormApp.getActiveForm().getDestinationId();
var ss = SpreadsheetApp.openById(SHEET_ID);
var form = FormApp.getActiveForm();
//get only the sheets with 'Roster' in the title
var sheets = ss.getSheets()
.filter(function(sheet) {return sheet.getName().match(/Roster/gi);});
@SIFAR786
SIFAR786 / Code.gs
Created June 3, 2018 23:59 — forked from rheajt/Code.gs
google apps script convert column number to letter
function columnToLetter(column, row) {
var temp, letter = '';
while (column > 0) {
temp = (column - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
column = (column - temp - 1) / 26;
}
return letter + row;
}
@SIFAR786
SIFAR786 / Code.gs
Created June 2, 2018 23:06 — forked from rheajt/Code.gs
examples of simple triggers with google apps script
/**
* These simple triggers are available in Sheets, Docs, and Forms
* Most of this information can be found:
* https://developers.google.com/apps-script/guides/triggers/events
*/
function onOpen(e) {
// {
// authMode: 'LIMITED',
// source: 'Spreadsheet' || 'Document' || 'Form',
// user: 'User'
@SIFAR786
SIFAR786 / sendgrid_eid.py
Created April 11, 2018 15:16 — forked from emiel/sendgrid_eid.py
Decode SendGrid Event ID in Python
def decode_eid(eid):
"""
Decodes a SendGrid event id (sg_event_id) and returns as uuid
"""
eid_len = len(eid)
if eid_len == 22:
res = uuid.UUID(bytes=base64.urlsafe_b64decode(eid + "=="))
elif eid_len == 48:
res = uuid.UUID(base64.urlsafe_b64decode(eid).decode("ascii"))