开发者

Can we upload files to google docs via linux shell script or python

开发者 https://www.devze.com 2023-03-09 14:27 出处:网络
Is it possible to upload files to google docs via comma开发者_如何学Pythonndline or bash or via python. i have plent of stuff to upload but i have only access to command line and shh nothing else.

Is it possible to upload files to google docs via comma开发者_如何学Pythonndline or bash or via python. i have plent of stuff to upload but i have only access to command line and shh nothing else.

is there way to do


Absolutely. You'll need the Google Docs API. Python should do a lovely job. There is also a bunch of example code from Google here with examples doing just this here.


For bash access, this is a useful FUSE driver for mounting Google Docs:

http://code.google.com/p/google-docs-fs/

Google provides a python client to the gdata APIs:

http://code.google.com/p/gdata-python-client/

And there are some useful python scripts that provide bash-like commands to access Google Docs:

http://code.google.com/p/gdatacopier/


Check this out: https://github.com/prasmussen/gdrive

For Ubuntu use gdrive-linux-x64:

$ wget -O gdrive "https://docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA&export=download"

$ chmod +x gdrive

$ echo "Hello World" > hello.txt

$ ./gdrive upload hello.txt
Authentication needed
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=##########
Enter verification code: 4/Zg#############er234

Uploading hello.txt
Uploaded 1g#############qU2 at 6.0 B/s, total 12.0 B

$ ./gdrive info 1g#############qU2
Id: 1g#############qU2
Name: hello.txt
Path: hello.txt
Mime: text/plain
Size: 12.0 B
Created: 2018-09-25 13:47:24
Modified: 2018-09-25 13:47:24
Md5sum: e59ff97941044f85df5297e1c302d260
Shared: True
Parents: 0AL#############3VA
ViewUrl: https://drive.google.com/a/positrace.com/file/d/1g#############qU2/view?usp=drivesdk
DownloadUrl: https://drive.google.com/a/positrace.com/uc?id=1g#############qU2&export=download
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号