How to use smartsheet - 4 common examples

To help you get started, we’ve selected a few smartsheet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smartsheet-samples / node-read-write-sheet / node-read-write-sheet.js View on Github external
// Build updated row with new cell value
            rowToUpdate = {
                id: sourceRow.id,
                cells: [{
                    columnId: columnMap["Remaining"],
                    value: 0
                }]
            };
        }
    }
    return rowToUpdate;
}

// Initialize client SDK
var ss = client.createClient({ accessToken: token, logLevel: 'info' });

var options = {
    path: "Sample Sheet.xlsx",
    fileName: "Sample Sheet.xlsx",
    queryParameters: {
        sheetName: "Sample Sheet",
        headerRowIndex: 0
    }
};

ss.sheets.importXlsxSheet(options)
    .then(function(result) {
        console.log("Created sheet '" + result.result.id + "' from excel file");
        // Load entire sheet
        ss.sheets.getSheet({ id: result.result.id })
        .then(function(sheet) {
github smartsheet-samples / smartsheet-cli / lib / functions / authenticate.js View on Github external
smartsheet.tokens.getAccessToken(options, (error, result) => {
                if (error) {
                    reject(error);
                    return;
                }
                // store the retrieved token to the local token.json file
                storeToken(result).then(() => {
                    resolve();
                }, (error) => {
                    reject(error);
                });
                // instantiate new smartsheet client for making API calls with the new token
                const newSmartsheet = smartsheetClient.createClient({
                    accessToken: result.access_token
                });
                resolve(newSmartsheet);
            });
            // send response to browser to let user know auth is successful
github smartsheet-samples / smartsheet-cli / lib / functions / authenticate.js View on Github external
return new Promise((resolve, reject) => {
            // make a call to smartsheet to test the validity of the token
            smartsheet = smartsheetClient.createClient({
                accessToken: access_token
            });

            smartsheet.users.getCurrentUser()
                .then(function(userProfile) {
                    // if token seems valid, save it to the token_file
                    const token = {access_token: access_token};

                    storeToken(token)
                        .then(() => {
                            resolve(smartsheet);
                        }, (error) => {
                            reject(error);
                        });
                })
                .catch(function(error) {
github smartsheet-samples / smartsheet-cli / lib / functions / authenticate.js View on Github external
'use strict'
const qs = require('querystring');
const path = require('path');
const fs = require('fs-extra');
const http = require('http');
const opn = require('opn');
const url = require('url');
const constants = require('../constants.js');

const smartsheetClient = require('smartsheet');
let smartsheet = smartsheetClient.createClient({
    accessToken: ''
});

function authorizeURL(params) {
    const authUrl = 'https://app.smartsheet.com/b/authorize';
    return `${authUrl}?${qs.stringify(params)}`;
}
/**
 * Saves access token to disk
 * 
 * @param token
 * @returns {Promise} 
 */
function storeToken(token) {
    return fs.ensureDir(constants.APP_DIR)
        .then(() => {

smartsheet

Smartsheet JavaScript client SDK

Apache-2.0
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Popular smartsheet functions