repl.it
@functorflow/

bot2sheets

Python

No description

fork
loading
Files
  • main.py
  • census-267806-55ccd5fedada.json
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds',
         'https://www.googleapis.com/auth/drive']

credentials = ServiceAccountCredentials.from_json_keyfile_name('./census-267806-55ccd5fedada.json', scope)

gc = gspread.authorize(credentials)


sht1 = gc.open_by_url("https://docs.google.com/spreadsheets/d/1O7MFJq7O3stMOmx7nsOc7UiBTvUb5hfaPATcJPxQJfA/edit?usp=sharing")

worksheet = sht1.get_worksheet(0)

val = worksheet.acell('B1').value


worksheet.update_cell(2, 2, 'Hello!')
worksheet.update_cell(3, 2, 'Koko!')


print(val)
print(worksheet.row_count)

Fetching token
?