Upload Excel document to shared folder on Google Drive with Excel VBA?

删除回忆录丶 提交于 2020-04-10 05:21:29

问题


I have found different scripts for Java, C#, and Access VBA for uploading a file to Google Drive. But the only thing I have found with Excel VBA, is a script saving the file in your local Google Drive folder and then wait for the application to sync it.

Is it possible to somehow upload the Excel file directly to a folder that has been shared with me? If yes, how?


回答1:


I actually managed to do this.

First, you need to create credentials. Follow this guide: https://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/

  • The credentials should be OAuth Client ID
  • Application Type: Other

Secondly, I downloaded this Access VBA code found here https://stackoverflow.com/a/34627231/1042624

Afterwards, in the Access document, there will be a settings box. You need to fill in the information about your account and the credentials from step 1 here. Then you can use the upload button, and it will work. However, if you want to use this in Excel and without the form boxes, then you have to step through the code and find where the settings form boxes´ info are being used. It takes quite a while, and the code is too long to post here. But now you at least have the information on how to do it.

NB: I still did not crack the 2-step verification that I have enabled.



来源:https://stackoverflow.com/questions/38762322/upload-excel-document-to-shared-folder-on-google-drive-with-excel-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!