Answer the question
In order to leave comments, you need to log in
How to write all values from column B of google spreadsheets to a list in Python?
The result should be like this - clients = [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] gmail.com, [email protected], [email protected], [email protected], [email protected], [email protected]]
Data should be taken from this table -
I'm stuck here -
from pprint import pprint
import gspread
import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials
# File retrieved from Google Developer Console
CREDENTIALS_FILE = 'my-python-food-dbddaae45da9.json'
# ID Google Sheets document (
can be taken from its URL) spreadsheet_id
=
'
1Ohtq7Mxw_L4FR0Vpi_aQxidorgfFv0l5q9ECtLS84g4
' ',
' https://www.googleapis.com/auth/drive '])
httpAuth = credentials.authorize(httplib2.Http())
service = apiclient.discovery.build('sheets', 'v4', http = httpAuth )
client = gspread.authorize(credentials)
sheet = client.open("First test document").sheet1
client1 = []
data = sheet.col_values(2)
clients = ''.join([str(x) for x in data])
client1.append(clients)
print(client1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question