Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple log usage to the read/write sheets sample. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions node-read-write-sheet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
console.log('Starting');

// TODO: Edit config.json to set desired sheet id and API token
var config = require("./config.json");
var config = require('./config.json');

var token = config.SMARTSHEET_ACCESS_TOKEN;

Expand Down Expand Up @@ -53,10 +53,12 @@ function evaluateRowAndBuildUpdates(sourceRow) {
}

// Initialize client SDK
var ss = client.createClient({ accessToken: token });
// TODO: Configure log level with one of the following, or remove the option to turn off logging:
// 'silly' | 'verbose' | 'debug' | 'info' | 'warn' | 'error'
var smartsheet = client.createClient({ accessToken: token, logLevel: 'info' });

// Load entire sheet
ss.sheets.getSheet({ id: sheetId })
smartsheet.sheets.getSheet({ id: sheetId })
.then(function(sheet) {
console.log("Loaded " + sheet.rows.length + " rows from sheet '" + sheet.name + "'");

Expand Down Expand Up @@ -86,7 +88,7 @@ ss.sheets.getSheet({ id: sheetId })
sheetId: sheet.id
};

ss.sheets.updateRow(updateRowArgs)
smartsheet.sheets.updateRow(updateRowArgs)
.then(function(updatedRows) {
console.log("Updated succeded");
})
Expand Down