How to change Excel format of a cell to number

Hi all,

Currently I am writing a data table to an excel file that has an “amount” column with number values. When the program finishes and I open the excel the format of the cell is a “Text” format. I wanna know is there any way to change the formatting to “Number”? Any help is appreciated thanks!

Invoke this below code in uipath, @kahoyim
and edit as per your need and download Excel Interop package,

Dim xlsApp As New Excel.Application
xlsApp.Visible = True
Dim xlsWorkbook As Excel.Workbook = xlsApp.Workbooks.Open(“C:\Users\v-padee\Desktop\demo.xlsx”)
Dim constant As Excel.XlCellType
constant = Excel.XlCellType.xlCellTypeConstants
With xlsWorkbook.Worksheets(1).Range(“A:A”).SpecialCells(constant, 2)
.NumberFormat = “General”
.Value = .Value
End With
and for more information check this below link,

1 Like