Skip to content

Instantly share code, notes, and snippets.

View patt0's full-sized avatar

Patrick Martinent patt0

  • Disrupt Digital
  • Kuala Lumpur
View GitHub Profile
@patt0
patt0 / cbl.js
Last active March 7, 2024 20:12
ContinuousBatchLibrary is a Google Apps Script library that manages large batches and works around the 5 minute limitation of GAS execution. It does this by setting time based triggers in the future as well as memorising the last processed key in the batch in order to restart from the correct position. At the end of the batch a cleanup function …
/**
* --- Continous Execution Library ---
*
* Copyright (c) 2013 Patrick Martinent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@patt0
patt0 / gist:5167237
Created March 15, 2013 03:15
This simple code snippet can be included in a Google Docs spreadsheet script editor to extract header information from email.
function processInbox() {
sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// get all threads with the label draft > replave with the lable you need
searchString = "label:draft";
var threads = GmailApp.search(searchString);
for (var i = 0; i < threads.length; i++) {
// get all messages in a given thread
var messages = threads[i].getMessages();