reportDisclaimerClick for DisclaimerThis Project is over a year old (first published about 4 years ago). As such, please keep in mind that some of the information may no longer be accurate, best practice, or a reflection of how I would approach the same thing today.
infoFull Project Detailsinfo_outlineClick for Full Project DetailsDate Posted:Jan. 10, 2016
ExaVault is essentially a service that provides file hosting with a simple directory interface, but has the distinct feature of offering FTP access and advanced permissions (which is why its user base is mainly businesses / enterprise). To make part of my job easier at work, I wanted to integrate our ExaVault access into a Google Scripts project I was working on. I wanted to have my Google Script retrieve a CSV from our ExaVault folder and parse and process it into a specific format. However, I quickly ran into an issue. ExaVault, by default, provides links to files through the FTP protocol. The links look like “ftp://links:firstname.lastname@example.org/transfer.pdf”. Unfortunately, the UrlFetchApp, which is a service Google Scripts uses to handle web requests, only works with HTTP/HTTPS requests/responses, and not the FTP protocol. So, I needed to figure out how get a direct link to my CSV in ExaVault, instead of a FTP link. The solution? Use the ExaVault API to generate a temporary direct link. It ended up being much easier than it sounds – ExaVault’s API is extremely easy to use. Here is my reusable code (below) – the return of my function is the direct download link to your file, which you can then pass to the URLFetchApp. Feel free to modify/reuse/do whatever you want with it (attribution not required, but is always appreciated). Username, password, and filepath are all mandatory arguments for the function, whereas opt_downloadname is optional. Make sure “api_key” is declared and set to your api key value (you will need to do a one-time generation of an API key here: https://clients.exavault.com/clientarea.php?action=products).