0

I have a project on Google App Scripts connected to my drive. I was able to save and organize my files (from mail) and directories in the drive using the script. now, I want to save the files to an FTP server and cannot find the References to do so.

how do I access an ftp server, create folders and upload files to them ?

thanks

Adam Mor
  • 1
  • 1
  • 1
  • I can confirm @noogui answer. Details: http://stackoverflow.com/questions/4594798/download-file-from-ftp-via-javascript/4594819#4594819[1] – metalcamp Oct 17 '16 at 12:19

2 Answers2

1

It seems this is not possible. If you check this Class UrlFetchApp, app script only supports HTTP and HTTPS communication over the internet. A supporthing SO thread seems to confirm this.

Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
0

The workaround to go from GAS -> FTP is as follows. I've been using this method for a number of years in production.

  1. From apps script, save the file to google drive
  2. Using Zapier, trigger to copy new filesfrom the google drive folder to a DropBox folder
  3. Using Microsoft Flow, trigger to copy new files from the Dropbox folder to an FTP or SFTP location.

You can probably do step 3 in Zapier as well. I use Microsoft Flow because I already had a significant number of automated tasks setup there. For Step, 2, I use Zapier because MS flow does not yet have a built-in trigger available based on a new file being saved to google drive. You would have to make your own custom trigger using the google drive API's.

Rod Bland
  • 11
  • 2