Writing a vb.net script(as a part of SSIS ETL) to convert xls to tsv file.I was trying to use the name
space Imports Microsoft.Excel
to include the below codes .But ,it show there is no
such name space! What name space to be included to use the Excel open close and save as
functionality as a part of the vb.net
oExcel.Workbooks.Open
oBook.SaveAs(sTsvPath, -4158)
The vb.net code is
Public Sub Main()
Dim oExcel As Object
Dim oBook As Object
Dim sFileName As String
Dim sFileNameOnly As String
Dim sXlsPath As String
Dim sTsvPath As String
sFileName = CStr(Dts.Variables("User::Xls_File_Name").Value)
sXlsPath = "H:\Xls_Files\" + sFileName
sFileNameOnly = Path.GetFileNameWithoutExtension(sFileName)
sTsvPath = "H:\Xls_Files\" + sFileNameOnly + ".Txt"
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Open(sXlsPath)
oBook.SaveAs(sTsvPath, -4158)
oBook.Close(False)
oExcel.Quit()
Dts.TaskResult = ScriptResults.Success
End Sub