Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read a csv file from SFTP using python?
#1
Using python script component.
Paste below script in meta information script section.
Provide connection credentials.

import pandas as pd
import paramiko
def myconnect():
   ssh = paramiko.SSHClient()
   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
   ssh.connect('localhost',port=22,username='user',password='123456')
   #print("connected suceessfully to SFTP Server")
   sftp_client = ssh.open_sftp()
   sftp_client.chdir('/home/user/folder_name')
   df= pd.read_csv(sftp_client.open('/home/user/folder_name/file_name.csv'))
   sftp_client.close()
   ssh.close()
   return df
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)