gsheet-api
Advanced tools
Comparing version 0.2.3 to 0.2.4
export declare class GoogleSheetService { | ||
addItem(spreadsheetID: string, sheetsTitle: string, clientEmail: string, privateKey: string, item: Array<any>, callback: () => void, error: (message: string) => void): Promise<void>; | ||
addItem(spreadsheetID: string, sheetsTitle: string, clientEmail: string, privateKey: string, item: Array<any>, callback: () => void, error: (message: string) => void, headerRow?: number): Promise<void>; | ||
} |
@@ -49,3 +49,3 @@ "use strict"; | ||
} | ||
GoogleSheetService.prototype.addItem = function (spreadsheetID, sheetsTitle, clientEmail, privateKey, item, callback, error) { | ||
GoogleSheetService.prototype.addItem = function (spreadsheetID, sheetsTitle, clientEmail, privateKey, item, callback, error, headerRow) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -70,3 +70,3 @@ var doc, sheet, rows_1, newRows_1, e_1; | ||
sheet = doc.sheetsByTitle[sheetsTitle]; | ||
return [4 /*yield*/, sheet.loadHeaderRow(1) | ||
return [4 /*yield*/, sheet.loadHeaderRow(headerRow !== null && headerRow !== void 0 ? headerRow : 1) | ||
// console.log("====== DOC TITLE : ", doc.title); | ||
@@ -73,0 +73,0 @@ // console.log("====== SHEET TITLE : ", sheet.title); |
{ | ||
"name": "gsheet-api", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,3 +39,3 @@ const { GoogleSpreadsheet } = require('google-spreadsheet'); | ||
export class GoogleSheetService { | ||
async addItem(spreadsheetID: string, sheetsTitle: string, clientEmail: string, privateKey: string, item: Array<any>, callback: () => void, error: (message: string) => void) { | ||
async addItem(spreadsheetID: string, sheetsTitle: string, clientEmail: string, privateKey: string, item: Array<any>, callback: () => void, error: (message: string) => void, headerRow?: number) { | ||
const doc = new GoogleSpreadsheet(spreadsheetID); | ||
@@ -51,3 +51,3 @@ | ||
const sheet = doc.sheetsByTitle[sheetsTitle]; // or use doc.sheetsById[id] or doc.sheetsByTitle[title] | ||
await sheet.loadHeaderRow(1) | ||
await sheet.loadHeaderRow(headerRow ?? 1) | ||
@@ -54,0 +54,0 @@ // console.log("====== DOC TITLE : ", doc.title); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86169