abstracted wrapper class for googleapis.sheets("v4") get and post methods to
manipulate google spreadsheets, class methods check if authentication is ready before each request
example
const api = new API(authClass); // authClass is an instance of any Class from IAuthClass set
batchUpdate(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
name
batchUpdate
desc
Applies one or more updates to the spreadsheet. Each request is validated before being applied.
If any request is not valid then the entire request will fail and nothing will be applied.
Some requests have replies to give you some information about how they are applied.
The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply,
then the response will have 2 empty replies, the actual reply, and another empty reply, in that order.
Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect
exactly your changes after this completes, however it is guaranteed that the updates in the request will
be applied together atomically. Your changes may be altered with respect to collaborator changes.
If there are no collaborators, the spreadsheet should reflect your changes.
const api = new API(authClass);
api.copyTo({
// The ID of the spreadsheet containing the sheet to copy.
spreadsheetId: "", // Update placeholder value.
// The ID of the sheet to copy.
sheetId: 0, // Update placeholder value.
resource: {
// The ID of the spreadsheet to copy the sheet to.
destinationSpreadsheetId: "", // Update placeholder value.
// Add desired properties to the request body.
}
}, (err, res) => {
if (err)
throw err;
console.log(res);
});
get(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
name
get
desc
Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID.
By default, data within grids will not be returned. You can include grid data one of two ways:
-Specify a field mask listing your desired fields using the fields URL parameter in HTTP
-Set the includeGridData URL parameter to true.
If a field mask is set, the includeGridData parameter is ignored For large spreadsheets,
it is recommended to retrieve only the specific fields of the spreadsheet that you want.
To retrieve only subsets of the spreadsheet, use the ranges URL parameter.
Multiple ranges can be specified. Limiting the range will return only the portions of the spreadsheet that
intersect the requested ranges.
Ranges are specified using A1 notation.
valuesBatchClear(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
name
batchClear
desc
Clears one or more ranges of values from a spreadsheet.
The caller must specify the spreadsheet ID and one or more ranges.
Only values are cleared--all other properties of the cell (such as formatting, data validation, etc) are kept.
const api = new API(authClass);
api.batchGet({
spreadsheetId: "", // Update placeholder value.
ranges: ["Sheet1!A1:B2", "Sheet2!A2:E5"],
// How values should be represented in the output.// The default render option is ValueRenderOption.FORMATTED_VALUE.
valueRenderOption: "", // Update placeholder value.// How dates, times, and durations should be represented in the output.// This is ignored if value_render_option is// FORMATTED_VALUE.// The default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].
dateTimeRenderOption: "", // TODO: Update placeholder value.
const api = new API(authClass);
api.batchUpdate({
spreadsheetId: "", // Update placeholder value.
resource: {
// How the input data should be interpreted.
valueInputOption: "USER_ENTERED", // Update placeholder value.
// The new values to apply to the spreadsheet. data: [{ // Update placeholder value. range:"Sheet1!A1:B2",
majorDimension:"ROWS",
values: [[1, 2], [null, "abdelrahman"]],
}],
// Add desired properties to the request body.
}
valuesClear(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
name
clear
desc
Clears values from a spreadsheet. The caller must specify the spreadsheet ID and range.
Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
API
abstracted wrapper class for googleapis.sheets("v4") get and post methods to manipulate google spreadsheets, class methods check if authentication is ready before each request
const api = new API(authClass); // authClass is an instance of any Class from IAuthClass set