My objective is to create a csv and sftp it without saving the file on the local machine using vb.net. Here is my create csv code:
Public Sub writeCSV()
Dim headers = (From header As DataGridViewColumn In
DataGridView1.Columns.Cast(Of DataGridViewColumn)() _
Select header.HeaderText).ToArray
Dim rows = From row As DataGridViewRow In DataGridView1.Rows.Cast(Of
DataGridViewRow)() _
Where Not row.IsNewRow _
Select Array.ConvertAll(row.Cells.Cast(Of
DataGridViewCell).ToArray, Function(c) If(c.Value IsNot Nothing,
c.Value.ToString, ""))
Using sw As New IO.StreamWriter("foo.csv")
sw.WriteLine(String.Join(",", headers))
For Each r In rows
sw.WriteLine(String.Join(",", r))
Next
End Using
'Process.Start("foo.csv")
'SFTP("foo.csv")
End Sub
Instead of starting and/or saving the process.. I'd like to write a sub that i can just sftp this foo.csv to a vendor's server. Is this possible? Also, the SFTP will need to use a key not a password.
Thanks in advance,