pull out sheet ID and page name

This commit is contained in:
David 2017-05-14 16:09:13 -04:00
parent faa0a42b05
commit d7df7e2b4e

View File

@ -8,6 +8,8 @@ var _ = require('lodash');
var SCOPES = ['https://www.googleapis.com/auth/spreadsheets']; var SCOPES = ['https://www.googleapis.com/auth/spreadsheets'];
var TOKEN_DIR = '.credentials/'; var TOKEN_DIR = '.credentials/';
var TOKEN_PATH = TOKEN_DIR + 'sheets.googleapis.com-my-library.json'; var TOKEN_PATH = TOKEN_DIR + 'sheets.googleapis.com-my-library.json';
var SHEET_ID = '1w5Dc57wV0_rrKFsG7KM-qdPWEpqYk6lFu3JzAA0cSv0';
var SHEET_NAME = 'Sheet1';
// Load client secrets from a local file. // Load client secrets from a local file.
fs.readFile(TOKEN_DIR + 'client_secret.json', function processClientSecrets(err, content) { fs.readFile(TOKEN_DIR + 'client_secret.json', function processClientSecrets(err, content) {
@ -148,12 +150,12 @@ function appendToSheet(auth, book) {
var sheets = google.sheets('v4'); var sheets = google.sheets('v4');
sheets.spreadsheets.values.append({ sheets.spreadsheets.values.append({
auth: auth, auth: auth,
spreadsheetId: '1w5Dc57wV0_rrKFsG7KM-qdPWEpqYk6lFu3JzAA0cSv0', spreadsheetId: SHEET_ID,
range: 'Sheet1', range: SHEET_NAME,
valueInputOption: "RAW", valueInputOption: "RAW",
insertDataOption: "INSERT_ROWS", insertDataOption: "INSERT_ROWS",
resource: { resource: {
"range": "Sheet1", "range": SHEET_NAME,
"majorDimension": "ROWS", "majorDimension": "ROWS",
"values": [ "values": [
book book