Add clear functionality to Google Sheet-Node

This commit is contained in:
Jan Oberhauser
2019-11-02 22:29:52 +01:00
parent d6134ec405
commit ac88d25e1b
2 changed files with 49 additions and 0 deletions

View File

@@ -45,6 +45,27 @@ export class GoogleSheet {
}
/**
* Clears values from a sheet
*
* @param {string} range
* @returns {Promise<object>}
* @memberof GoogleSheet
*/
async clearData(range: string): Promise<object> {
const client = await this.getAuthenticationClient();
const response = await Sheets.spreadsheets.values.clear(
{
auth: client,
spreadsheetId: this.id,
range,
}
);
return response.data;
}
/**
* Returns the cell values
*/