diff --git a/lib/spreadsheet.js b/lib/spreadsheet.js index 7055e51..1ab4606 100644 --- a/lib/spreadsheet.js +++ b/lib/spreadsheet.js @@ -20,7 +20,7 @@ exports.create = exports.load = function(opts, callback) { return callback("Missing authentication information"); if (!opts.spreadsheetId && !opts.spreadsheetName) return callback("Missing 'spreadsheetId' or 'spreadsheetName'"); - if (!opts.worksheetId && !opts.worksheetName) + if (typeof worksheetId == 'undefined' && !opts.worksheetName) return callback("Missing 'worksheetId' or 'worksheetName'"); //default to true if useCellTextValues is not set or defined. @@ -68,7 +68,7 @@ Spreadsheet.prototype.init = function(callback) { this.getSheetId('spread', function(err) { if (err) return callback(err, null); _this.getSheetId('work', function(err) { - if (err) return callback(err, null); + if (err && (_this.opts.worksheetId == 0 && !err.match('worksheet (.*) not found'))) return callback(err, null); _this.setTemplates(); callback(null, _this); });