nithinmurali / pygsheets

Google Sheets Python API v4

Home Page:https://pygsheets.readthedocs.io/en/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_values ignores the start string if no end string is specified

maksam07 opened this issue · comments

Describe the bug
get_values ignores the start string if no end string is specified.

To Reproduce
I want to get all rows starting from the second for the three columns, since the first row is the column headers.

rng = ws.get_values('A2', 'C', returnas='range')
print(rng)

But in response I get: <DataRange 'TEST'!A1:C1000>
I see the same thing in the other returnas values - the first row is the column header
If I write this code:

rng = ws.get_values('A2', 'C1000', returnas='range')

I will get the right answer: <DataRange 'TEST'!A2:C1000>

Why might there be such behavior?

System Information

  • OS: Kubuntu
  • pygsheets version : 2.0.6
  • pygsheets installed from (github or pypi): pypi

I am unable to reproduce this. Does your sheet have some special characteristics? or is it a normal new sheet?

I am unable to reproduce this. Does your sheet have some special characteristics? or is it a normal new sheet?

Unfortunately, this is no longer relevant for the time being; I'm no longer doing that project. We can temporarily close this thread. If I ever come back to it, we'll talk again

@nithinmurali

sh = gc.open_by_key('***')
ws = sh.worksheet_by_title('***')
print(ws.range('A1:C'))
print(ws.range('A2:C'))
print('*' * 20)
print(ws.range('A1:C5'))
print(ws.range('A2:C5'))

Output:

[[<Cell A1 '1'>, <Cell B1 '11'>, <Cell C1 '111'>], [<Cell A2 '2'>, <Cell B2 '22'>, <Cell C2 '222'>], [<Cell A3 '3'>, <Cell B3 '33'>, <Cell C3 '333'>], [<Cell A4 '4'>, <Cell B4 '44'>, <Cell C4 '444'>], [<Cell A5 '5'>, <Cell B5 '55'>, <Cell C5 '555'>], [<Cell A6 ''>, <Cell B6 ''>, <Cell C6 ''>], [<Cell A7 ''>, <Cell B7 ''>, <Cell C7 ''>], [<Cell A8 ''>, <Cell B8 ''>, <Cell C8 ''>], [<Cell A9 ''>, <Cell B9 ''>, <Cell C9 ''>], [<Cell A10 ''>, <Cell B10 ''>, <Cell C10 ''>]]
[[<Cell A1 '1'>, <Cell B1 '11'>, <Cell C1 '111'>], [<Cell A2 '2'>, <Cell B2 '22'>, <Cell C2 '222'>], [<Cell A3 '3'>, <Cell B3 '33'>, <Cell C3 '333'>], [<Cell A4 '4'>, <Cell B4 '44'>, <Cell C4 '444'>], [<Cell A5 '5'>, <Cell B5 '55'>, <Cell C5 '555'>], [<Cell A6 ''>, <Cell B6 ''>, <Cell C6 ''>], [<Cell A7 ''>, <Cell B7 ''>, <Cell C7 ''>], [<Cell A8 ''>, <Cell B8 ''>, <Cell C8 ''>], [<Cell A9 ''>, <Cell B9 ''>, <Cell C9 ''>], [<Cell A10 ''>, <Cell B10 ''>, <Cell C10 ''>]]
********************
[[<Cell A1 '1'>, <Cell B1 '11'>, <Cell C1 '111'>], [<Cell A2 '2'>, <Cell B2 '22'>, <Cell C2 '222'>], [<Cell A3 '3'>, <Cell B3 '33'>, <Cell C3 '333'>], [<Cell A4 '4'>, <Cell B4 '44'>, <Cell C4 '444'>], [<Cell A5 '5'>, <Cell B5 '55'>, <Cell C5 '555'>]]
[[<Cell A2 '2'>, <Cell B2 '22'>, <Cell C2 '222'>], [<Cell A3 '3'>, <Cell B3 '33'>, <Cell C3 '333'>], [<Cell A4 '4'>, <Cell B4 '44'>, <Cell C4 '444'>], [<Cell A5 '5'>, <Cell B5 '55'>, <Cell C5 '555'>]]

ws.range('A2:C') - still returns from the first line, unless a lower bound is specified on the right side

2023-06-19_13-42