Apps Script and SFTP

1,966 views
Skip to first unread message

Laurie Nason

unread,
Oct 7, 2021, 1:03:36 AM10/7/21
to google-apps-sc...@googlegroups.com
Hi all,
Just wondering if anyone knows if apps script can use sftp to create a file on a remote server? I have googled and the consensus (at least in the articles I read) was no, there's no facility to do that. There are various helper (paid for) linkers that say they will do it, but was wondering if there was any native solution yet?
Laurie

dimud...@gmail.com

unread,
Oct 7, 2021, 5:37:45 PM10/7/21
to Google Apps Script Community
As far as I know, its not currently possible to connect to a SFTP server directly from Apps Script. You'd have to use an intermediary service. I've used Cloud Functions (written in NodeJS which supports FTP) to do this in the past. Cloud Functions can be deployed as HTTP endpoints that you can call out to from Apps Script.

Clark Lind

unread,
Oct 8, 2021, 7:59:58 PM10/8/21
to Google Apps Script Community
Not directly. In fact, it seems that javascript would have a hard time doing it too. However, if you have a server that you interact with using JS or GAS, PHP may be able to do it for you:
https://techtalkbook.com/file-upload-via-sftp-using-php/

Some of the advanced services show PHP as one of the client libraries, so you just might be able to figure something out. It just won't be a "direct" solution; e.g., use GAS to load a file to a server, that server uses PHP to send the file to another server via SFTP, etc.

On Thursday, October 7, 2021 at 1:03:36 AM UTC-4 Laurie Nason wrote:
Reply all
Reply to author
Forward
0 new messages