Hi,
I want to copy a data (like 1,82%) and paste to another excel document in same format. Is there any activity or a way for this?
Hi,
I think that there is no native UiPath activity to copy and paste the format of excel data. But you can have a try on the below:
- Use “Select Range” to select the data → send hotkey to Ctrl + C → Focus on another excel → use “Select Range” again to mark the destination → send hotkey to Ctrl + P
- Another way is to write some simple VBA code to do so. I can help if you want to explore this further.
I don’t want to do this by opening the excel file, so please help me about vba code.
Sorry for the late reply. In case you still want the code, below would be a sample vba code:
Public Function Main()
Dim wbk As Workbook
Set wbk = Workbooks.Open("Path to second workbook")
ThisWorbook.Sheets("Sheet1").Range("B2:D4").Copy
wbk.Sheets("Sheet2").Range("B2:D4").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End Function
To execute this code in UiPath, the simple way is to use excel application scope to open the first excel, then use invoke vba activity to execute the code.
Hello,
Have a look at the “modern” Excel activities They are both available for Studio and StudioX .
The read range activity has the option of preserving the format
And once you have read the range you can easily paste it using Append Range
Also there is the Copy/Paste Range activity
Which let’s you decide what to copy : values , fomulas , formats or all of them
Hope this helps,
Dragos.