Updating a spreadsheet in Google Docs

I have a python script that takes the generated CSV and loads it into Google Docs. It can load it just fine, put it, I can not get it to replace the data, it returns an error, I can not find the link.

Le Code:

import gdata.auth import gdata.docs import gdata.docs.service import gdata.docs.data import gdata.docs.client email = ' admin@domain.com ' CONSUMER_KEY='domain.com' CONSUMER_SECRET='blah54545blah' ms_client = gdata.docs.client.DocsClient('Domain_Doc_Upload') ms_client.auth_token = gdata.gauth.TwoLeggedOAuthHmacToken(CONSUMER_KEY, CONSUMER_SECRET, email) url = 'http://docs.google.com/feeds/documents/private/full/sd01blahgarbage' ms = gdata.data.MediaSource(file_path="C:\\people.csv", content_type='text/csv') csv_entry2 = ms_client.Update(url, ms) 

It returns:

 Traceback (most recent call last): File "so_test.py", line 19, in <module> csv_entry2 = ms_client.Update(ms, url) File "build\bdist.win-amd64\egg\gdata\client.py", line 717, in update AttributeError: 'MediaSource' object has no attribute 'to_string' 

I can’t find anything about the 'to_string' attribute, so I got lost on the track. Any help is greatly appreciated.

+4
source share
1 answer

I looked through the docs and it looks like the Update method accepts (record, ms) where entry should be a gdata.docs.data.DocsEntry object. You should be able to get a DocsEntry object by receiving a feed from your client.

feed = client.GetDocList ()

+1
source

Source: https://habr.com/ru/post/1398867/


All Articles