Released Pack: Google Drive Extra

Hey there! I’m releasing a simple pack for some additional Google Drive functionalities: Google Drive Extra

Install
When adding the pack to your doc you will be prompted to sign in to your google account. The app is not yet verified, that will take 4-6 weeks if they even approve it:

So it’s going to warn you like this:

Just click “Show Advanced” and then “Go to coda.io (unsafe)” to continue like normal.

The pack only connects to Google’s API as shown here

Formula: DownloadDriveFile(url)
It can download private files from your drive directly into coda. It returns a temporary Coda URL, to store it permanently you can ingest it. Here are full instructions:

  • Get the url to your google drive file (Easy to get these from the official drive pack)
  • Put this URL in a column in a table
  • Create a new column of the type File in the table
  • Create a button that puts the result from DownloadDriveFile into this file column
  • The click function can look something like this:
    • thisRow.ModifyRows(thisRow.File, [Google Drive Extra]::DownloadDriveFile([Rickard Abraham], thisRow.URL))
  • When the button is then pressed it will store the file permanently in the file column cell like this:
    image
  • This file can now be used with other packs, mainly my own PDF Pack
5 Likes

Update

  • Filenames are now inherited from the Drive into Coda
2 Likes

Hi @Rickard_Abraham,

I just tried to download video files (around 100 - 200 MB). Unfortunately, that didn’t work as intended. I then tried again with another file that was only 1 MB and that worked.

My guess is that there are limits. Do you know anything about that?

It shows this error:

Google Drive Extra error
Failed to take action in Google Drive Extra

I am on Team plan and everything with a maximum file size of 250 MB should work, so my Coda settings are not the problem. The link is also right.

Jannis

1 Like

Hej Jannis thanks for reaching out!
I’m afraid this is the 4MB limit discussed here

I enabled source code sharing on this pack if you’d like to have a look, I can’t think of a solution right now other than sharing the drive file to anyone with a URL and ingesting that directly into a Coda file column without auth

2 Likes

Hi @Rickard_Abraham,

thanks for the quick response and sharing the source code of your pack.
I took a look into your linked topic. At the last reply, Eric said:

Is that something you’ve thought about? I think your pack would suit very well for this.

1 Like

No worries! Increasing that limit doesn’t seem ideal, 4 MB is pretty high already for a single request. The solution should be for Coda to download the file in chunks but I can’t find any way for it to happen inside the pack.

I had some hope when I found this section in Coda’s documentation on private images which lets us feed an entire URL to Coda’s blob creator. But it seems it doesn’t do chunking either, instead trying to download the whole thing in one go, thus giving us the same error

Formula DownloadDriveFile failed: 13 INTERNAL: FetchError: content size at https://www.googleapis.com/drive/v3/files/1o-jIfjt...?alt=media over limit: 4194304

4194304 bytes = 4 MiB = 4.19 MB

I think our best bet is to ask if Coda could make this function download content in chunks to match the workspace file size limit:

context.temporaryBlobStorage.storeUrl
2 Likes

Better error messages

File too big
image

Bad login
image

Filenames

Filenames stopped working after latest update, I failed getting them working again. I believe there’s a bug with ingesting temporary URLs yielded from context.temporaryBlobStorage.storeUrl where the filename isn’t transferred, I emailed Coda about this

Filenames are working! I was confused by what I believe was caching behavior, all good now

3 Likes

New Formula: DriveFileInfo(url)

Returns an object containing all fields from a Google Drive File object
Use ParseJSON() to extract any value.
Thanks @Chris_Williams for requesting!

New Formula: FileSizeReadable(bytes)

Converts number of bytes into a human readable string
Credit: Andrew on stackoverflow

Example!

Bytes formula: thisRow.[File Data].ParseJSON("size")

2 Likes

Larger Files

Coda approved my request for larger responses! :clap:
You can now download files up to 10 MB (previously 4 MB)

7 Likes

DriveFileInfo(url) now returns blank if there’s an error

This allows us to detect if there’s any issues (deleted file mainly), since we can’t catch errors in CFL (yet ^^)

3 Likes