Module Module_Main Sub Main() Dim MyExcel As New Microsoft.Office.Interop.Excel.Application Dim FileExcel = "C:\Users\Uipath\Downloads\File.xls" Dim Book = MyExcel.Workbooks.Open(FileExcel, False, True) Dim Sheet As Microsoft.Office.Interop.Excel.Worksheet = DirectCast(Book.Worksheets(1), Microsoft.Office.Interop.Excel.Worksheet) Dim R As Integer = Sheet.Rows.Count Dim C As Integer = Sheet.Columns.Count Console.WriteLine("R = " + R.ToString) Console.WriteLine("C = " + C.ToString) Dim Table As Object(,) Table = DirectCast(Sheet.Range("A1:" + ColumnIndexToColumnLetter(C) + R.ToString).Value, Object(,)) Dim txt As String = "" For Row As Integer = 1 To CInt(Table.Length / C) Dim subtxt As String = "" For i As Integer = 1 To C If Table(Row, i) IsNot Nothing Then subtxt += Table(Row, i).ToString + vbTab End If Next If subtxt.Length > 0 Then txt += subtxt + vbCrLf Next My.Computer.FileSystem.WriteAllText(FileExcel + ".txt", txt, False) Book.Close(False) Stop End Sub Private Function ColumnIndexToColumnLetter(colIndex As Integer) As String Dim div As Integer = colIndex Dim colLetter As String = String.Empty Dim modnum As Integer While div > 0 modnum = (div - 1) Mod 26 colLetter = Chr(65 + modnum) & colLetter div = CInt((div - modnum) \ 26) End While Return colLetter End Function End Module