get method

Future<Spreadsheet> get(
  1. String spreadsheetId, {
  2. String? commentsViewMode,
  3. bool? excludeTablesInBandedRanges,
  4. bool? includeGridData,
  5. List<String>? ranges,
  6. String? $fields,
})

Returns the spreadsheet at the given ID.

The caller must specify the spreadsheet ID. By default, data within grids is not returned. You can include grid data in one of 2 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, as a best practice, retrieve only the specific spreadsheet fields that you want. To retrieve only subsets of spreadsheet data, use the ranges URL parameter. Ranges are specified using A1 notation. You can define a single cell (for example, A1) or multiple cells (for example, A1:D5). You can also get cells from other sheets within the same spreadsheet (for example, Sheet2!A1:C4) or retrieve multiple ranges at once (for example, ?ranges=A1:D5&ranges=Sheet2!A1:C4). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.

Request parameters:

spreadsheetId - The spreadsheet to request.

commentsViewMode - The comments view mode to apply to the spreadsheet. This allows viewing the spreadsheet with comments omitted or included. If one is not specified, COMMENTS_VIEW_MODE_OMITTED is used. Possible string values are:

  • "COMMENTS_VIEW_MODE_UNSPECIFIED" : The CommentsViewMode is unspecified; COMMENTS_VIEW_MODE_OMITTED is applied.
  • "COMMENTS_VIEW_MODE_DEFAULT_FOR_CURRENT_ACCESS" : The CommentsViewMode applied to the returned spreadsheet depends on the user's current access level. If the user only has view access, COMMENTS_VIEW_MODE_OMITTED is applied. Otherwise, COMMENTS_VIEW_MODE_INCLUDED is applied.
  • "COMMENTS_VIEW_MODE_OMITTED" : The returned spreadsheet has comments omitted.
  • "COMMENTS_VIEW_MODE_INCLUDED" : The returned spreadsheet has comments included. Requests to retrieve a spreadsheet using this mode will return a 403 error if the user does not have permission to view comments.

excludeTablesInBandedRanges - True if tables should be excluded in the banded ranges. False if not set.

includeGridData - True if grid data should be returned. This parameter is ignored if a field mask was set in the request.

ranges - The ranges to retrieve from the spreadsheet.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Spreadsheet.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Spreadsheet> get(
  core.String spreadsheetId, {
  core.String? commentsViewMode,
  core.bool? excludeTablesInBandedRanges,
  core.bool? includeGridData,
  core.List<core.String>? ranges,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'commentsViewMode': ?commentsViewMode == null ? null : [commentsViewMode],
    'excludeTablesInBandedRanges': ?excludeTablesInBandedRanges == null
        ? null
        : ['${excludeTablesInBandedRanges}'],
    'includeGridData': ?includeGridData == null
        ? null
        : ['${includeGridData}'],
    'ranges': ?ranges,
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ = 'v4/spreadsheets/' + commons.escapeVariable('$spreadsheetId');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Spreadsheet.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}