how to convert by command in UiPath ? without opening excel
you do this with assign activity ?
Yes @Nightowl_music
Can you hover on the warning symbol and send the screenshot ? @Nightowl_music
Hi @Nightowl_music ,
We can use simple VB code in the invoke code activity to perform this step without opening the excel. please refer the below old post which i suggested solution. thanks.
what is the code I need?
Could you please refer the link i posted above that is having the desired code. thanks
In assign @Nightowl_music
Left side
SumOfColumn which is string variable
Right side
DT.AsEnumerable.Sum(Function(x) Convert.ToDouble(x(“ColumnName”).ToString.Trim) ).ToString
don’t know which one is the code, thanks
Try like this @Nightowl_music
please can you be more exact, im a beginner
Hi @Nightowl_music ,
ok. Please find the below code it will help you to achieve your task. modify the code(range, excel path and sheet name) to suit your requirement.
use the below code invoke code activity to perform the action changing the format from text to number.
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim cell As Microsoft.Office.Interop.Excel.Range
Try
excel = New Microsoft.Office.Interop.Excel.ApplicationClass
wb = excel.Workbooks.Open(“Your excel file path”)
excel.Visible=True
ws=CType(wb.Sheets(“Your Sheet Name”),Microsoft.Office.Interop.Excel.Worksheet)
ws.Activate
For Each cell In ws.Range(“E2:E10”).Cells
cell.Value = cell.Value
Next
Catch es As Exception
'System.Windows.MessageBox.Show(es.Message)
End Try
wb.Save
wb.close
excel.Quit
wb=Nothing
ws=Nothing
excel=Nothing
GC.Collect()
and also make sure that you imported the following package Microsoft.Office.Interop.Excel
how to implement that in Invoke Code? im getting error all the time
im getting this error,
Invoke code: Exception has been thrown by the target of an invocation.
please can you upload your project?