class_docstr: Encapsulates a means to identify a Sheets document.
  
  The gspread library provides three ways to look up a Sheets document: by name,
  by url and by key. An instance of this class represents exactly one of the
  methods.
class_docstr_tok: ["Encapsulates","a","means","to","identify","a","Sheets","document",".","The","gspread","library","provides","three","ways","to","look","up","a","Sheets","document",":","by","name",",","by","url","and","by","key",".","An","instance","of","this","class","represents","exactly","one","of","the","methods","."]
docstr: Constructor.
  
  Exactly one of the arguments should be provided.
  
  Args:
    name: The name of the Sheets document. More-than-one Sheets documents can
      have the same name, so this is the least precise method of identifying
      the document.
    key: The key of the Sheets document
    url: The url to the Sheets document
  
  Raises:
    ValueError: If the caller does not specify exactly one of name, url or
    key.
docstr_tok: ["Constructor",".","Exactly","one","of","the","arguments","should","be","provided",".","Args",":","name",":","The","name","of","the","Sheets","document",".","More-than-one","Sheets","documents","can","have","the","same","name",",","so","this","is","the","least","precise","method","of","identifying","the","document",".","key",":","The","key","of","the","Sheets","document","url",":","The","url","to","the","Sheets","document","Raises",":","ValueError",":","If","the","caller","does","not","specify","exactly","one","of","name",",","url","or","key","."]
code: def __init__(
      self,
      name: str | None = None,
      key: SheetsKey | None = None,
      url: SheetsURL | None = None,
  ):
      """Constructor.
  
      Exactly one of the arguments should be provided.
  
      Args:
        name: The name of the Sheets document. More-than-one Sheets documents can
          have the same name, so this is the least precise method of identifying
          the document.
        key: The key of the Sheets document
        url: The url to the Sheets document
  
      Raises:
        ValueError: If the caller does not specify exactly one of name, url or
        key.
      """
      self._name = name
      self._key = key
      self._url = url
  
      # There should be exactly one.
      num_inputs = (
          int(bool(self._name))
          + int(bool(self._key))
          + int(bool(self._url))
      )
      if num_inputs != 1:
          raise ValueError("Must set exactly one of name, key or url")
  
file_path: generative-ai-python/google/generativeai/notebook/sheets_id.py
imports: from __future__ import annotations
  import re
  from google.generativeai.notebook import sheets_sanitize_url
label_desc: Use image node_id 1 to create a new SheetsIdentifier object  with example: obj = SheetsIdentifier(name, key, url)