This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var request = require('request'); | |
var EventEmitter = require('events').EventEmitter; | |
var mime = require('mime'); | |
var util = require('util'); | |
function resumableUpload() { | |
this.byteCount = 0; //init variables | |
this.tokens = {}; | |
this.filepath = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Download a file | |
*/ | |
function downloadFile(fileId) { | |
var request = gapi.client.drive.files.get({ | |
'fileId': fileId | |
}); | |
request.execute(function(resp) { | |
window.location.assign(resp.webContentLink); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BACKUP_FOLDER_ID = 'INSERT_FOLDER_ID_HERE'; | |
var NATIVE_MIME_TYPES = {}; | |
NATIVE_MIME_TYPES[MimeType.GOOGLE_DOCS] = MimeType.MICROSOFT_WORD; | |
NATIVE_MIME_TYPES[MimeType.GOOGLE_SHEETS] = MimeType.MICROSOFT_EXCEL; | |
NATIVE_MIME_TYPES[MimeType.GOOGLE_SLIDES] = MimeType.MICROSOFT_POWERPOINT; | |
var NATIVE_EXTENSIONS = {}; | |
NATIVE_EXTENSIONS[MimeType.GOOGLE_DOCS] = '.docx'; | |
NATIVE_EXTENSIONS[MimeType.GOOGLE_SHEETS] = '.xlsx'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet(e) { | |
Logger.log(e); | |
var op = e.parameter.action; | |
var ss = SpreadsheetApp.open(DriveApp.getFileById("YOUR_SPREADSHEET_ID")); | |
var sn = "YOUR_SHEET_NAME"; | |
var sheet = ss.getSheetByName(sn); | |
if (op == "insert") | |
return insert_value(e, sheet); |