Spreadsheets

Struct Spreadsheets 

Source
pub struct Spreadsheets {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

Source§

impl Spreadsheets

Source

pub async fn create( &self, body: &Spreadsheet, ) -> Result<Response<Spreadsheet>, ClientError>

This function performs a POST to the /v4/spreadsheets endpoint.

Creates a spreadsheet, returning the newly created spreadsheet.

Source

pub async fn get( &self, spreadsheet_id: &str, include_grid_data: bool, ranges: &[String], ) -> Result<Response<Spreadsheet>, ClientError>

This function performs a GET to the /v4/spreadsheets/{spreadsheetId} endpoint.

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.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • include_grid_data: bool – True if we should generate data with the “alternate” series. This differs based on the type and amount of source data.
  • ranges: &[String] – The ranges that were cleared, in A1 notation. If the requests are for an unbounded range or a ranger larger than the bounds of the sheet, this is the actual ranges that were cleared, bounded to the sheet’s limits.
Source

pub async fn developer_metadata_get( &self, spreadsheet_id: &str, metadata_id: i64, ) -> Result<Response<DeveloperMetadata>, ClientError>

This function performs a GET to the /v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId} endpoint.

Returns the developer metadata with the specified ID. The caller must specify the spreadsheet ID and the developer metadata’s unique metadataId.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • metadata_id: i64 – The zero-based index where the rule should be inserted.

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/developerMetadata:search endpoint.

Returns all developer metadata matching the specified DataFilter. If the provided DataFilter represents a DeveloperMetadataLookup object, this will return all DeveloperMetadata entries selected by it. If the DataFilter represents a location in a spreadsheet, this will return all developer metadata associated with locations intersecting that region.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn sheets_copy( &self, spreadsheet_id: &str, sheet_id: i64, body: &CopySheetAnotherSpreadsheetRequest, ) -> Result<Response<SheetProperties>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • sheet_id: i64 – The zero-based index where the rule should be inserted.
Source

pub async fn values_get( &self, spreadsheet_id: &str, range: &str, date_time_render_option: DateTimeRenderOption, major_dimension: Dimension, value_render_option: ValueRenderOption, ) -> Result<Response<ValueRange>, ClientError>

This function performs a GET to the /v4/spreadsheets/{spreadsheetId}/values/{range} endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • range: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • date_time_render_option: crate::types::DateTimeRenderOption – 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 SERIAL_NUMBER.
  • major_dimension: crate::types::Dimension – The major dimension that results should use. For example, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension=ROWS returns [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension=COLUMNS returns [[1,3],[2,4]].
  • value_render_option: crate::types::ValueRenderOption – How values should be represented in the output. The default render option is FORMATTED_VALUE.
Source

pub async fn values_update( &self, spreadsheet_id: &str, range: &str, include_values_in_response: bool, response_date_time_render_option: DateTimeRenderOption, response_value_render_option: ValueRenderOption, value_input_option: ValueInputOption, body: &ValueRange, ) -> Result<Response<UpdateValuesResponse>, ClientError>

This function performs a PUT to the /v4/spreadsheets/{spreadsheetId}/values/{range} endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • range: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • include_values_in_response: bool – Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns).
  • response_date_time_render_option: crate::types::DateTimeRenderOption – Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
  • response_value_render_option: crate::types::ValueRenderOption – Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
  • value_input_option: crate::types::ValueInputOption – How the input data should be interpreted.
Source

pub async fn values_append( &self, spreadsheet_id: &str, range: &str, include_values_in_response: bool, insert_data_option: InsertDataOption, response_date_time_render_option: DateTimeRenderOption, response_value_render_option: ValueRenderOption, value_input_option: ValueInputOption, body: &ValueRange, ) -> Result<Response<AppendValuesResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values/{range}:append endpoint.

Appends values to a spreadsheet. The input range is used to search for existing data and find a “table” within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the guide and sample code for specific details of how tables are detected and data is appended. The caller must specify the spreadsheet ID, range, and a valueInputOption. The valueInputOption only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • range: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • include_values_in_response: bool – Determines if the update response should include the values of the cells that were appended. By default, responses do not include the updated values.
  • insert_data_option: crate::types::InsertDataOption – How the input data should be inserted.
  • response_date_time_render_option: crate::types::DateTimeRenderOption – Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
  • response_value_render_option: crate::types::ValueRenderOption – Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
  • value_input_option: crate::types::ValueInputOption – How the input data should be interpreted.
Source

pub async fn values_clear( &self, spreadsheet_id: &str, range: &str, body: &ClearValuesRequest, ) -> Result<Response<ClearValuesResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values/{range}:clear endpoint.

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.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • range: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn values_batch_clear( &self, spreadsheet_id: &str, body: &BatchClearValuesRequest, ) -> Result<Response<BatchClearValuesResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values:batchClear endpoint.

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.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn values_batch_clear_data_filter( &self, spreadsheet_id: &str, body: &BatchClearValuesByDataFilterRequest, ) -> Result<Response<BatchClearValuesByDataFilterResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter endpoint.

Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared – all other properties of the cell (such as formatting, data validation, etc..) are kept.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn values_batch_get( &self, spreadsheet_id: &str, date_time_render_option: DateTimeRenderOption, major_dimension: Dimension, ranges: &[String], value_render_option: ValueRenderOption, ) -> Result<Response<BatchGetValuesResponse>, ClientError>

This function performs a GET to the /v4/spreadsheets/{spreadsheetId}/values:batchGet endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
  • date_time_render_option: crate::types::DateTimeRenderOption – 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 SERIAL_NUMBER.
  • major_dimension: crate::types::Dimension – The major dimension that results should use. For example, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension=ROWS returns [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension=COLUMNS returns [[1,3],[2,4]].
  • ranges: &[String] – The ranges that were cleared, in A1 notation. If the requests are for an unbounded range or a ranger larger than the bounds of the sheet, this is the actual ranges that were cleared, bounded to the sheet’s limits.
  • value_render_option: crate::types::ValueRenderOption – How values should be represented in the output. The default render option is ValueRenderOption.FORMATTED_VALUE.
Source

pub async fn values_batch_get_data_filter( &self, spreadsheet_id: &str, body: &BatchGetValuesByDataFilterRequest, ) -> Result<Response<BatchGetValuesByDataFilterResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter endpoint.

Returns one or more ranges of values that match the specified data filters. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges that match any of the data filters in the request will be returned.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn values_batch_update( &self, spreadsheet_id: &str, body: &BatchUpdateValuesRequest, ) -> Result<Response<BatchUpdateValuesResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values:batchUpdate endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn values_batch_update_data_filter( &self, spreadsheet_id: &str, body: &BatchUpdateValuesByDataFilterRequest, ) -> Result<Response<BatchUpdateValuesByDataFilterResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter endpoint.

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

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn batch_update( &self, spreadsheet_id: &str, body: &BatchUpdateSpreadsheetRequest, ) -> Result<Response<BatchUpdateSpreadsheetResponse>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}:batchUpdate endpoint.

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.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.
Source

pub async fn get_data_filter( &self, spreadsheet_id: &str, body: &GetSpreadsheetByDataFilterRequest, ) -> Result<Response<Spreadsheet>, ClientError>

This function performs a POST to the /v4/spreadsheets/{spreadsheetId}:getByDataFilter endpoint.

Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters will return the portions of the spreadsheet that intersect ranges matched by any of the filters. 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 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.

Parameters:

  • spreadsheet_id: &str – The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; ‘row.values.’ should not be specified. A single "\*" can be used as short-hand for listing every field.

Trait Implementations§

Source§

impl SpreadsheetOps for Spreadsheets

Source§

fn cell_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sheet_id: &'life1 str, cell_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Response<String>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get single cell value. The cell_name is something like A1 and what is returned is a string representation of the cell’s value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more