Adam Mor
Adam Mor

Reputation: 1

how copy files from google drive to an ftp server using google app scripts?

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

Upvotes: 0

Views: 4155

Answers (2)

Rod Bland
Rod Bland

Reputation: 11

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.

Upvotes: 0

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17651

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.

Upvotes: 1

Related Questions