Hi I want convert a csv file delimited by character “|” to new excel file. Is there any option to convert other than text to column from modern activity
because through this activity i will have read csv , write range workbook content of csv to excel and then use text to column, can you please let me know any other option like vba or c# for converting from text to column
→ Use Read CSV activity. In the properties panel set the Delimiter to Pipe and store the data in data table sat dt_data.
→ Use Write Range workbook to write the data back to excel. make sure to enable Add Headers option
Since your text input is of extension.txt right. You can pass the same text file path in Read CSV acitvity and store it in data table. After that use Write Range Workbook to write it back to exce.
You can try the below code in Invoke VBA activity.
Sub ImportTextFile()
Dim filePath As String
Dim delimiter As String
Dim ws As Worksheet
' Set the file path and delimiter
filePath = "C:\Users\spputhucode\Documents\UiPath\BlankProcess21\Input.txt" ' Replace with your file path
delimiter = "|"
' Create a new worksheet
Set ws = Worksheets.Add
' Import data from text file
With ws.QueryTables.Add(Connection:="TEXT;" & filePath, Destination:=ws.Range("A1"))
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFilePlatform = xlWindows
.TextFileParseType = xlDelimited
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileOtherDelimiter = delimiter
.Refresh
End With
End Sub