I want to know how to upload CSV files to the folder specified in GoogleDrive
I am thinking of uploading CSV created daily using Google-drive-ruby to GoogleDrive's designated folder on rails batches.
(API is here http://www.rubydoc.info/gems/google_drive/2.1.2/GoogleDrive/Session)
Gemfile
gem 'google_drive', '2.1.2'
Batch Files
require "google_drive"
require "csv"
(omitted)
defaultupload_csv
session.upload_from_file(
my_csv,
"# {Date.today.strftime('my_csv_%Y%m%d%H%M%S')}",
convert —true
)
end
I can upload CSV itself with the above code, but I can't select the folder to upload to, so I just throw it into the top screen of GoogleDrive.
I would like to upload CSV to a folder dedicated to the batch, but the API does not mention how to do so.
On the contrary, if you look at the API source, you will see the following TODO:
#TODO:Add a feature to upload to a folder.
Is it not possible to specify the folder to be uploaded according to the current specification?
If you can't, please let me know if you know any other good ways.
(I don't want to use Google_drive version down as much as possible.)
This is my first time to ask a programming question online.
If there is anything that can be improved by asking questions, I would appreciate it if you could point that out.
Thank you for your cooperation.
#TODO:Add a feature to upload to a folder.
Also, it seems that the upload function to a specific folder has not yet been implemented, so if you only need to transfer, how about calling an external program such as rclone
using system
as follows?
system("rclone${local_path}#{remote_path}")
© 2024 OneMinuteCode. All rights reserved.