Friday, August 2, 2019

Getting started with Google Spread Sheet API with Python Tutorial

Google SpreadSheet

Google SpreadSheet API with Python

Learn about Google Spread Sheet API with Python

Github : https://github.com/soumilshah1995/Google-SpreadSheet-APi-with-Python-

Soumil Nitin Shah

Bachelor in Electronic Engineering | Masters in Electrical Engineering | Master in Computer Engineering |

Hello! I’m Soumil Nitin Shah, a Software and Hardware Developer based in New York City. I have completed by Bachelor in Electronic Engineering and my Double master’s in Computer and Electrical Engineering. I Develop Python Based Cross Platform Desktop Application , Webpages , Software, REST API, Database and much more I have more than 2 Years of Experience in Python

Step 1:

In [1]:
import requests
from apiclient.discovery import build

Step 2:

In [2]:
Api_Key = "API KEY"
SpreadSheetId="SPREAD SHEET ID GOES HERE"
In [5]:
sheet = build('sheets', 'v4', developerKey=Api_Key)
In [6]:
type(sheet)
Out[6]:
googleapiclient.discovery.Resource

Step 3:

In [7]:
resp = sheet.spreadsheets().get(spreadsheetId=SpreadSheetId)
In [9]:
data = resp.execute()
In [10]:
data
Out[10]:
{'spreadsheetId': '1Lpc63DVAJhXogu4fUSyGDQGkzjwiqR8SvCOnLwxNY1Y',
 'properties': {'title': 'Youtube',
  'locale': 'en_US',
  'autoRecalc': 'ON_CHANGE',
  'timeZone': 'America/New_York',
  'defaultFormat': {'backgroundColor': {'red': 1, 'green': 1, 'blue': 1},
   'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
   'verticalAlignment': 'BOTTOM',
   'wrapStrategy': 'OVERFLOW_CELL',
   'textFormat': {'foregroundColor': {},
    'fontFamily': 'arial,sans,sans-serif',
    'fontSize': 10,
    'bold': False,
    'italic': False,
    'strikethrough': False,
    'underline': False}}},
 'sheets': [{'properties': {'sheetId': 0,
    'title': 'MySheet',
    'index': 0,
    'sheetType': 'GRID',
    'gridProperties': {'rowCount': 1000, 'columnCount': 26}}}],
 'spreadsheetUrl': 'https://docs.google.com/spreadsheets/d/1Lpc63DVAJhXogu4fUSyGDQGkzjwiqR8SvCOnLwxNY1Y/edit'}

Step 4

Accessing Title of your Spread Sheet

In [11]:
data["properties"]["title"]
Out[11]:
'Youtube'

Accessing the Sheet Name

In [18]:
data["sheets"][0]["properties"]["title"]
Out[18]:
'MySheet'

Passing Argument

In [53]:
resp = sheet.spreadsheets().get(spreadsheetId=SpreadSheetId, includeGridData=True)
In [55]:
data = resp.execute()
data
Out[55]:
{'spreadsheetId': '1Lpc63DVAJhXogu4fUSyGDQGkzjwiqR8SvCOnLwxNY1Y',
 'properties': {'title': 'Youtube',
  'locale': 'en_US',
  'autoRecalc': 'ON_CHANGE',
  'timeZone': 'America/New_York',
  'defaultFormat': {'backgroundColor': {'red': 1, 'green': 1, 'blue': 1},
   'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
   'verticalAlignment': 'BOTTOM',
   'wrapStrategy': 'OVERFLOW_CELL',
   'textFormat': {'foregroundColor': {},
    'fontFamily': 'arial,sans,sans-serif',
    'fontSize': 10,
    'bold': False,
    'italic': False,
    'strikethrough': False,
    'underline': False}}},
 'sheets': [{'properties': {'sheetId': 0,
    'title': 'MySheet',
    'index': 0,
    'sheetType': 'GRID',
    'gridProperties': {'rowCount': 1000, 'columnCount': 26}},
   'data': [{'rowData': [{'values': [{'userEnteredValue': {'stringValue': 'Sensor'},
         'effectiveValue': {'stringValue': 'Sensor'},
         'formattedValue': 'Sensor',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'LEFT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}},
        {'userEnteredValue': {'stringValue': 'Value'},
         'effectiveValue': {'stringValue': 'Value'},
         'formattedValue': 'Value',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'LEFT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}}]},
      {'values': [{'userEnteredValue': {'stringValue': 'Temperature'},
         'effectiveValue': {'stringValue': 'Temperature'},
         'formattedValue': 'Temperature',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'LEFT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}},
        {'userEnteredValue': {'numberValue': 22},
         'effectiveValue': {'numberValue': 22},
         'formattedValue': '22',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'RIGHT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}}]},
      {'values': [{'userEnteredValue': {'stringValue': 'Humidity'},
         'effectiveValue': {'stringValue': 'Humidity'},
         'formattedValue': 'Humidity',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'LEFT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}},
        {'userEnteredValue': {'numberValue': 66},
         'effectiveValue': {'numberValue': 66},
         'formattedValue': '66',
         'effectiveFormat': {'backgroundColor': {'red': 1,
           'green': 1,
           'blue': 1},
          'padding': {'top': 2, 'right': 3, 'bottom': 2, 'left': 3},
          'horizontalAlignment': 'RIGHT',
          'verticalAlignment': 'BOTTOM',
          'wrapStrategy': 'OVERFLOW_CELL',
          'textFormat': {'foregroundColor': {},
           'fontFamily': 'arial,sans,sans-serif',
           'fontSize': 10,
           'bold': False,
           'italic': False,
           'strikethrough': False,
           'underline': False},
          'hyperlinkDisplayType': 'PLAIN_TEXT'}}]}],
     'rowMetadata': [{'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21},
      {'pixelSize': 21}],
     'columnMetadata': [{'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize'#39;: 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100},
      {'pixelSize': 100}]}]}],
 'spreadsheetUrl': 'https://docs.google.com/spreadsheets/d/1Lpc63DVAJhXogu4fUSyGDQGkzjwiqR8SvCOnLwxNY1Y/edit'}
In [61]:
# ------------------------------------- ROW INDEX---COL INDEX---
data["sheets"][0]["data"][0]["rowData"][0]["values"][0]["userEnteredValue"]["stringValue"]
Out[61]:
'Sensor'

Better Method

In [63]:
range_name = 'A:B'
result = sheet.spreadsheets().values().get(
    spreadsheetId=SpreadSheetId,
    range=range_name).execute()
rows = result.get('values', [])
print("{} rows Retrieved ".format(len(rows)))
print(rows)
3 rows Retrieved 
[['Sensor', 'Value'], ['', '22'], ['Temperature', '66']]
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

No comments:

Post a Comment

How to Use Publish-Audit-Merge Workflow in Apache Iceberg: A Beginner’s Guide

publish How to Use Publish-Audit-Merge Workflow in Apache Iceberg: A Beginner’s Guide ¶ In [24]: from ...