Skip to content

Instantly share code, notes, and snippets.

View RomainVialard's full-sized avatar

Romain Vialard RomainVialard

View GitHub Profile
@brainysmurf
brainysmurf / concurrency.gs
Last active May 24, 2024 18:31
Concurrent processing in App Scripts
/**
* Pretends to take a long time to return two rows of data
*
* @param {string} endpoint
* @return {ResponseObject}
*/
function doSomething (endpoint) {
Utilities.sleep(5 * 1000); // sleep for 5 seconds
return {
numberOfRows: 2,
@mhawksey
mhawksey / getRowsData.gs
Created February 29, 2016 13:27
getRowsData and setRowsData - originally from the Google Apps Script developer site
// setRowsData fills in one row of data per object defined in the objects Array.
// For every Column, it checks if data objects define a value for it.
// Arguments:
// - sheet: the Sheet Object where the data will be written
// - objects: an Array of Objects, each of which contains data for a row
// - optHeadersRange: a Range of cells where the column headers are defined. This
// defaults to the entire first row in sheet.
// - optFirstDataRowIndex: index of the first row where data should be written. This
// defaults to the row immediately below the headers.
function setRowsData(sheet, objects, optHeadersRange, optFirstDataRowIndex) {