Skip to content

Instantly share code, notes, and snippets.


Brian bennettscience

View GitHub Profile
View Google Script to shorten URLs.
// Grabbed from
// Add a menu action item when the sheet is opened.
function onOpen() {
.addItem("Go !!","rangeShort")
View Create QR in Google Sheets
bennettscience / inlineDrawing
Created Aug 13, 2015
Getting Inline Drawings from Google Docs
View inlineDrawing
// Don't forget your global variables up top.
// Search through the page elements. Paragraphs are top-level, which is why I start with those.
if( type == DocumentApp.ElementType.PARAGRAPH ){
// Look for child elements within the paragraph. Inline Drawings are children.
if(element.asParagraph().getNumChildren() !=0 && element.asParagraph().getChild(0).getType() == DocumentApp.ElementType.INLINE_DRAWING) {
// For whatever reason, drawings don't have their own methods in the InlineDrawing class. This bit copies and adds it to the bottom of the doc.
var drawing = element.asParagraph().copy();
We couldn’t find that file to show.
// This function converts a document from English to Spanish quickly.
// The post from
// was helpful for creating the logic to check for images in the document.
function translate() {
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
// Add a page break for the translated material.
This is based on the template shared by Amit Agarwal (@labnol) on
the blog, Digital Inspiration. The original post with instructions:
// Find the form that is collecting the information to upload.
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
// Add a custom menu item to the document when opened.
function onOpen() {
var ui = DocumentApp.getUi()
.createMenu('Set Fonts')
function setFont(){
var doc = DocumentApp.getActiveDocument();
bennettscience / newCSS.css
Created Sep 22, 2015
CSS styles for landing page
View newCSS.css
/* Copy this CSS into the CSS Editor from the wp-admin dashboard */
#main {
display: block;
float: left;
margin: 0 auto;
width: 100%;
/* Modify only the style of the landing page post ID */
#post-1301 .entry-content {
bennettscience / form.html
Created Sep 24, 2015
Google Drive public dropbox upload
View form.html
<div id="wrapper">
<h1>Student Work Submission</h1>
<form id="myForm">
<input type="text" name="myName" placeholder="Your name.." />
<select name="classPer">
bennettscience / template.html
Last active Sep 29, 2015
Generates an HTML page based on form input data. This source should be hosted as a webpage.
View template.html
<style type="text/css" media="screen"> <!-- Style the template -->
html,body {
p {
You can’t perform that action at this time.