Downloading SFTP files in Excel using Win SCP?

vpan16

Board Regular
Joined
Jun 13, 2016
Messages
92
We had a script that took all the FTP files (.csv formatted) from a report directory matching the times a user inputted and opened them in excel.

But all of our logins have moved from FTP to SFTP.

Now my understanding is, with SFTP we cannot simply go to teh internet, we would need to extract data from an SFTP client.
I heard that WinSCP can do this seamlessly.

I've followed the protocol to get the winscp assembly/library as a reference in my developer tools.

I just dont really understand the coding and syntax itself.
My WinSCP.exe file is not in the same directory as the .dll file and so I get an error say the winscp.exe executable was not found at location of the assembly, nor in any installation path. You may use Session.ExecutablePath property to explicitly set path to winscp.exe.

Now I have no idea how that works, ive tried everything but looks like there is no variable type as Session?

Not sure how to proceed. Has anyone successfully used VBA to download SFTP files into excel and would be willing to share their codes (without the SFTP credentials of course)


The code I am currently using is modified from this one right here: https://winscp.net/eng/docs/library_vb#example
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top