Options
All
  • Public
  • Public/Protected
  • All
Menu

Class API

name

API

classdesc

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

Hierarchy

  • API

Index

Constructors

constructor

Properties

authClass

authClass: IAuthClass

Methods

batchUpdate

  • 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.

    alias

    spreadsheets.batchUpdate

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.batchUpdate
    
    example

    
    const api = new API(authClass);
    api.batchUpdate({
        spreadsheetId: "",
        resource: {
            // @see Requests
            requests: [{
                "deleteSheet": {
                    "sheetId": "",
                }
            }],
            // Add desired properties to the request body.
        }
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

copyTo

  • copyTo(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
  • name

    copyTo

    desc

    Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.

    alias

    spreadsheets.sheets.copyTo

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.sheets.copyTo
    
    example

    
    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);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

get

  • 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.

    alias

    spreadsheets.get

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.get
    
    example

    
    const api = new API(authClass);
    api.get({
        spreadsheetId: "",
        includeGridDate: false,
        ranges: ["Sheet1!A1:B2", "Sheet2!A2:B3"],
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesBatchClear

  • 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.

    alias

    spreadsheets.values.batchClear

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.batchClear
    
    example

    
    const api = new API(authClass);
    api.batchClear({
        spreadsheetId: "", // Update placeholder value.
        resource: {
            ranges: ["Sheet1!A1:B2", "Sheet2!A2:E5"],
            // Add desired properties to the request body.
        }
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesBatchGet

  • valuesBatchGet(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
  • name

    batchGet

    desc

    Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.

    alias

    spreadsheets.values.batchGet

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.batchGet
    
    example

    
    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.
    

    }, (err, res) => { if (err) throw err; console.log(res); });

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesBatchUpdate

  • valuesBatchUpdate(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
  • name

    batchUpdate

    desc

    Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges.

    alias

    spreadsheets.values.batchUpdate

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.batchUpdate
    
    example

    
    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.
    }
    

    }, (err, res) => { if (err) throw err; console.log(res); });

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesClear

  • 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.

    alias

    spreadsheets.values.clear

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.clear
    
    example

    
    const api = new API(authClass);
    api.clear({
        spreadsheetId: "", // Update placeholder value.
        range: "Sheet1!B4:E10",
        resource: {
            // Add desired properties to the request body.
        }
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesGet

  • valuesGet(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
  • name

    getValues

    desc

    Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.

    alias

    spreadsheets.values.get

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.get
    
    example

    
    const api = new API(authClass);
    api.getValues({
        spreadsheetId: "", // Update placeholder value.
        range: "Sheet1!B4:E10",
        resource: {
            // Add desired properties to the request body.
        }
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

valuesUpdate

  • valuesUpdate(params: object, options?: any | Callback<any>, callback?: Callback<any>): void
  • name

    update

    desc

    Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.

    alias

    spreadsheets.values.update

    see

    alias

    throws

    wrapped method errors

    see

    Wrapped Method

    - sheets.spreadsheets.values.update
    
    example

    
    const api = new API(authClass);
    api.valuesUpdate({
        spreadsheetId: "", // Update placeholder value.
        range: "Sheet1!A1:E1",
        valueInputOption: "USER_ENTERED",
        resource: {
            majorDimension: "ROWS",
            values: [
                ["Data", 123.45, true, "=MAX(D2:D4)", "10"]
            ],
            // Add desired properties to the request body.
        }
    }, (err, res) => {
        if (err)
            throw err;
        console.log(res);
    });
    

    Parameters

    • params: object

      Parameters for request

    • Optional options: any | Callback<any>
    • Default value callback: Callback<any> = noop

      The callback that handles the response.

    Returns void

    • Request object

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method