shareplum
shareplum copied to clipboard
getfile() no local file
Using shareplum to download files and manipulate locally. It's authenticating and I can delete files successfully. Not sure where files are downloading to when running folder.get_file('source.txt')
I am having the same problem. If you solve this problem please let me know. Thanks!
get_file() returns the contents of the file, so you want to do file_contents = folder.get_file('source.txt') then write file_contents to a file handle if you want it on disk.
As @isaacnorman82 says, get_file() returns the contents.
Here is a full example that will write your remote source.txt to output.txt in your current working directory:
with open("output.txt", "w") as sink:
file_contents = folder.get_file('source.txt')
sink.write(file_contents)
You might want/need to specify binary mode ("wb") when handling binary files like Office documents or archives.