I have a sheet with the struct below.
COLUMN1 | COLUMN2 | COLUMN3
0 | 3 | 1
1 | 3 |
2 | 5 | 4
4 | 2 | 2
How can I return just the column 1 and 2 by its column name? Not by the index. Using the wks.get_all_values() as shown bellow, it will return all columns of the sheet.
My code:
ss = gs.open(args['name'])
wks = ss.worksheet(args['worksheet'])
data = wks.get_all_values()
headers = data.pop(0)
df = pd.Dataframe(data, columns=headers)
I was needing something like, wks.get_columns(['COLUMN1','COLUMN2'])
I hope someone can help me. Thanks