5

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?

4

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
  • Unfortunately this gives me a 403 Google error – Jonathan Doe Sep 25 '15 at 3:36
  • A HTTP 403 error indicates that the user isn't allowed access to the requested resource. Can you access the download URL used directly from your browser? Have sharing permissions on the document changed? – gar Sep 25 '15 at 9:04
0
  1. The file should be shared to anyone or to anyone with the link
  2. If the file is "small enough" the URL to be used should have the form

    https://drive.google.com/uc?export=download&id=FILE_ID
    
  3. If the file is big it could not be imported by using IMPORTDATA as Google Drive big files return a warning

References

Google Drive direct download for big files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.