Skip to content

Instantly share code, notes, and snippets.

View mvogelgesang's full-sized avatar

Mark Vogelgesang mvogelgesang

View GitHub Profile
@mvogelgesang
mvogelgesang / FilePermissionsReview.gs
Created June 6, 2017 21:58
Review file permissions in Google Drive for a given folder
// This global array identifies which access scopes shall be excluded. L
var ACCESS_WHITELIST = ["PRIVATE"]; // "ANYONE", "ANYONE_WITH_LINK", "DOMAIN", "DOMAIN_WITH_LINK", "PRIVATE"];
function fileActivityReport() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("OUTPUT").clear();
var folderId = showPrompt();
if (folderId != "") {
// Log the name of every folder in the user's Drive.
@mvogelgesang
mvogelgesang / richText2HTMLExample.js
Last active March 23, 2024 10:41
Converts Google AppScript RichTextValue to HTML encoded strings.
/**
* 2019 @mvogelgesang
* This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@mvogelgesang
mvogelgesang / inputdata.csv
Created April 13, 2020 12:15
Shell script to loop through a CSV file containing a series of values to find and replace
newterm1 oldterm1
newterm2 oldterm2
newterm3 oldterm3
@mvogelgesang
mvogelgesang / example.managedContentType
Last active July 20, 2020 16:50
Example Salesforce Content Type
<?xml version="1.0" encoding="UTF-8"?>
<ManagedContentType xmlns="http://soap.sforce.com/2006/04/metadata">
<description>A simple content type for Salesforce CMS</description>
<developerName>simple</developerName>
<managedContentNodeTypes>
<helpText></helpText>
<isLocalizable>true</isLocalizable>
<isRequired>true</isRequired>
<nodeLabel>Title</nodeLabel>
<nodeName>title</nodeName>
@mvogelgesang
mvogelgesang / emailFileExtractor.gs
Last active April 22, 2021 17:46
Extract email attachments from gmail
/* Script can be run against a Gmail inbox to fetch all emails that appear in a given search result and saves the attachments to the desired Drive folder. A spreadsheet is also created which shows the sender, subject, attachment name, and link to attachment.
*/
/* CONFIG */
// Choose your destination folder
var folderId = '';
// set the search string - just copy and paste query from gmail
var searchString = '';
// by default, does not download images from email messages
var attachmentOptions = { 'includeInlineImages': false, 'includeAttachments': true};
// name of the RFI or project for download

Dates

YYYY-MM-DD

^(((19|20)\d{2})\-(0?[1-9]|1[0-2])\-(0?[1-9]|1\d|2\d|3[01])$)

MM/DD/YYYY

^$|((0?[1-9]|1[0-2])\/(0?[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$)

@mvogelgesang
mvogelgesang / companyCopy.gs
Created January 22, 2021 20:19
Google Drive - Company Copy
/**
* This script reviews specific folders and the files contained within it
* to identify those not owned by your domain and then make subsequent copies
* of those files which will be owned by you.
*
* Getting started:
* Set the COMPANY_DOMAIN
* Set the BASE_FOLDER
*/
<html dir="ltr" lang="en-US">
<head>
<title>GSA Labs | Home</title>
<meta name="google-site-verification" content="DP9wUZj5bsrKfUDPgFVudlP2YTlL-s5D3dItygqv_74">
<meta name="keywords"
content="Government applications,Government open source,sharing applications,GSA Labs,GSA,Government Salesforce Community of Excellence,Community of Excellence,Salesforce BPA">
<!-- We participate in the US government's analytics program. See the data at analytics.usa.gov. -->
<script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js" nonce=""></script>
@mvogelgesang
mvogelgesang / sitescan.gs
Created February 20, 2021 19:25
Site Scanner
/**
* A series of custom Google Sheet functions that allow someone to scan a spreadsheet of websites
* @author mvogelgesang http://github.com/mvogelgesang
*/
/**
* Checks to see if website has an /about, /aboutus, or /about-us page
*
* @param {URL} siteURL - URL of the site
* @return {boolean} - True or False if site has page
@mvogelgesang
mvogelgesang / addExtLinkArrow.js
Last active April 22, 2022 18:38
Add External Link Arrow to Relevant Links
const validUrls = []; // to add
document.addEventListener("DOMContentLoaded", function(event) {
setTimeout(() => {
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
if (!anchors[i].href.includes(".gov") && //ignore .gov links
!anchors[i].href.includes(".mil") && //ignore .mil links
!anchors[i].href.includes("javascript:void(0)") && //ignore blanks
!anchors[i].href.includes("mailto:") && //ignore email links