问题
So I'm starting to really get into utilizing Google Drive to streamline my many personal projects. One of the things I'd love to do is figure out how to download CSV files onto my Google Drive, and have Google Sheets automatically do an =IMPORTDATA
on any new .csv files in a specific directory.
I've come across a number of problems trying to figure this out, but the biggest issue is that putting any kind of file on the Google Drive doesn't give you a link to the file itself, but rather something like such:
https://drive.google.com/a/xxxx/file/x/xxxxxxxxxxxxxxxx/view?usp=sharing
=IMPORTDATA
doesn't recognize this as a .csv file. How can I go about doing this?
回答1:
I found the answer from another forum:
Generating a direct download link, as described in this article seems to work fine with the =IMPORTDATA
function.
To summarize, you take the SITE_ID string from the sharing link you have:
https://drive.google.com/file/d/FILE_ID/edit?usp=sharing
Using this, you can generate the direct download link for use with the =IMPORTDATA
function:
https://drive.google.com/uc?export=download&id=FILE_ID
来源:https://stackoverflow.com/questions/32473639/importdata-google-sheet-csv-on-google-drive