Skip to content

Instantly share code, notes, and snippets.

View mbeyeler's full-sized avatar

Michael Beyeler mbeyeler

View GitHub Profile
@fmarais
fmarais / backup.js
Created May 3, 2020 12:16
This script will automatically save spreadsheet sheets when edited in Google docs.
function myOnEdit() {
var fileId = "1Ly5SSIE9d-b_IA6VxDB1HF3pnf37SPf22KhZVv3PPiVA1w";
var folderId = "1S1F8NpjOfbxY_4n27llfqh6eOs3Kb1eojaq";
var file = DriveApp.getFileById(fileId);
var folder = DriveApp.getFolderById(folderId);
var now = new Date();
var fileNameDate = now.getFullYear() + "-" + zeroPrefix_(now.getMonth()+1) + "-" + zeroPrefix_(now.getDate()) + 'T' + zeroPrefix_(now.getHours()) + ":" + zeroPrefix_(now.getMinutes()) + ":" + zeroPrefix_(now.getSeconds())