The read_google_sheet method reads data from a specified range of cells in a Google Sheet. This method requires that the user has the appropriate Google Sheets permissions configured in their Narada extension.
This method requires Google Sheets access to be configured in the Narada extension. If this is your first time using Google Sheets methods, the Narada extension will prompt you to authorize access. The user must have read permissions for the specified spreadsheet.

Method Signature

async def read_google_sheet(
    self,
    *,
    spreadsheet_id: str,
    range: str,
    timeout: int | None = None,
) -> ReadGoogleSheetResponse

Parameters

spreadsheet_id
str
required
The ID of the Google Sheet. This is the long string in the Google Sheets URL.
# From URL: https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
spreadsheet_id="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
range
str
required
The range of cells to read in A1 notation. Can include sheet name.
range="A1:C10"           # Range on default sheet
range="Sheet1!A1:C10"    # Range on specific sheet
range="Data!B2:E20"      # Named sheet with range
timeout
int | None
default:"None"
Maximum time in seconds to wait for the operation to complete.
timeout=30     # Wait up to 30 seconds
timeout=None   # Use default timeout

Return Value

Returns a ReadGoogleSheetResponse object with the following structure:
values
list[list[str]]
A 2D array containing the cell values from the specified range. Each inner list represents a row.
# Example response
response.values = [
    ["Name", "Age", "City"],
    ["Alice", "25", "New York"],
    ["Bob", "30", "San Francisco"]
]

Example

import asyncio
from narada import Narada

async def main():
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Read data from a Google Sheet
        response = await window.read_google_sheet(
            spreadsheet_id="1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
            range="Sheet1!A1:C10"
        )

        # Access the data
        for row in response.values:
            print(row)

if __name__ == "__main__":
    asyncio.run(main())