Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

jordan rhea rheajt

🏠
Working from home
View GitHub Profile
@rheajt
rheajt / Code.gs
Created Jul 29, 2020
Google Classroom API to Build Classrooms
View Code.gs
function main() {
// 1. get the courses from the spreadsheet
const courses = getCoursesFromSpreadsheet();
// 2. create the courses on the classroom
const responses = courses.map((course, ind) => {
const resource = createCourseResource(course);
const response = Classroom.Courses.create(resource);
course[3] = response.alternateLink;
View Code.gs
function doGet() {
var html = HtmlService
.createHtmlOutputFromFile('form')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
return html;
}
function submit(name) {
@rheajt
rheajt / UpdateNamedRanges.ts
Created Apr 20, 2020
[UpdateNamedRangs] excel typescript to update the ranges of all named ranges in a workbook #excel #typescript
View UpdateNamedRanges.ts
async function main(context: Excel.RequestContext) {
// Your code here
const items = context.workbook.names.load('items')
await context.sync();
items.items.forEach(item => {
const lastIndex = item.formula.lastIndexOf('$');
const main = item.formula.substring(0, lastIndex + 1);
const split = +item.formula.substring(lastIndex + 1);
@rheajt
rheajt / index.html
Last active Jan 6, 2020
[Publish Google Sheet to the Web] easily turn your google sheets into a JSON data source #gaspowered
@rheajt
rheajt / Code.gs
Last active Dec 11, 2019
[slide data templates] auto-magically pull data from a spreadsheet into a slidedeck #gaspowered
View Code.gs
function onOpen() {
SlidesApp.getUi().createMenu('Template')
.addItem('Build template', 'buildTemplate')
.addToUi();
}
function buildTemplate() {
var presentation = SlidesApp.getActivePresentation();
var newPresentation = DriveApp.getFileById(presentation.getId())
.makeCopy('COPY OF TEMPLATE');
@rheajt
rheajt / Code.gs
Last active Dec 10, 2019
[Marking Application] old project #gaspowered
View Code.gs
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Marking Application')
.addItem('Open App', 'openApp')
.addToUi();
}
function openApp() {
var html = HtmlService.createHtmlOutputFromFile('app');
View SampleMarkdown.md

Sample Markdown file

This is going to be a test file for the Office 365 Add-in Tutorial

@rheajt
rheajt / Code.gs
Last active Feb 26, 2018
google apps script to update all youtube video descriptions
View Code.gs
function main() {
var videos = YouTube.Search.list('snippet', {
type: 'video',
maxResults: 50,
forMine: true
});
var allVideos = videos.items;
while(videos.nextPageToken) {
View getClassroomRosters.gs
function getClassroomRosters() {
var courses = Classroom.Courses.list().courses;
var email = Session.getActiveUser().getEmail();
for(var i = 0; i < courses.length; i++) {
var courseState = courses[i].courseState;
var teacher = Classroom.Courses.Teachers.get(courses[i].id, email);
var isTeacher = teacher.userId === courses[i].ownerId;
if (courseState == "ACTIVE" && isTeacher) {
@rheajt
rheajt / Code.gs
Last active Dec 6, 2017
google apps script project
View Code.gs
function onOpen() {
DocumentApp.getUi()
.createAddonMenu()
.addItem('run', 'spaceErase')
.addToUi();
}
function spaceErase() {
var body = DocumentApp.getActiveDocument().getBody();
body.replaceText('(\\s{2})', ' ');
You can’t perform that action at this time.