Last active
August 31, 2016 19:04
-
-
Save javiercbk/4143466947a56c5052ac79af9e9c7ce4 to your computer and use it in GitHub Desktop.
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 Spreadsheet = require('./spreadsheets').Spreadsheet; | |
const RAW = "RAW"; | |
var spreadsheet = new Spreadsheet(); | |
var authorizePromise = spreadsheet.authorize(); | |
authorizePromise.then(function(){ | |
//spreadsheetId should be replace with the actual spreadsheet id | |
//sheetname should be replaced with the actual sheetname | |
//this will read all the rows from D3 to F4 | |
return spreadsheet.getRows('spreadsheetId', 'sheetname!D3:F4'); | |
}).then(function(rows){ | |
//print those rows | |
console.log('rows: ' + JSON.stringify(rows)); | |
}).then(function(){ | |
var payload = { | |
//you can use COLUMNS to write up to down or ROWS to write left to right | |
"majorDimension": "COLUMNS", // "majorDimension": "ROWS" | |
"values": [{values: [123]}, {values: ['the dude abides']}, {values: [123.213]}] | |
}; | |
//this will write the values in starting from ROW D3. | |
return spreadsheet.editRows('spreadsheetId', payload, 'sheetname!D3:F4', RAW); | |
}).catch(function(err){ | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment