M
M
Mykyta_M2017-10-21 11:08:49
Python
Mykyta_M, 2017-10-21 11:08:49

How to update a spreadsheet sheet in google drive using python?

Hey! Can you please tell me how can I update a whole sheet in Google spreadsheets with data from xml or csv file using python and google spreadsheet api? Is there a method that takes a file as an argument? Preferably with gspread.
While it turns out to update only the specified cells, rows and columns

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Samokhin, 2017-10-21
@Mykyta_M

gspread has an import_csv() method

import gspread
API_KEY = '/../../91caf1a6016.json'
SPREADSHEET_ID = 'hlrauXcTXeQZ_H-Kwn5sVucQzWam-kByJsF1VxtscNLo'
scope=[
    'https://spreadsheets.google.com/feeds',
    'https://www.googleapis.com/auth/drive'
]
result = 'строка с CSV данными, прочитайте из вашего файла'
credentials = ServiceAccountCredentials.from_json_keyfile_name(API_KEY, scope)
gc = gspread.authorize(credentials)
gc.import_csv(SPREADSHEET_ID, result)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question