Search code examples
pythongoogle-sheetsgspread

Get specific sheet range using gspread acell


I want to get specific sheet range which consists of multiple row for example :

enter image description here

So my code is :

    work_book = sheet.get_worksheet(sheet_idx)
    row_value = work_book.acell('A1:C3').value
    print(row_value)

When I run the code I only get value from cell A1 (which is empty). If I use A2:C3, the result will be Hello. I expected it will show entire sheet range. Should I loop or something? Please assist.


Solution

  • acell only returns a single cell. For a range you should use get https://gspread.readthedocs.io/en/latest/api.html#gspread.models.Worksheet.get