My issue is that when I try to get input from one workbook and pass the values into another workbook where the cells contain formulas, the formulas get erased. Instead of just updating the value, it behaves like pasting over the cell and removes the existing formula.
Hi @rahul.g
Instead of writing directly over formula cells, design your destination workbook so formulas pull values from a separate ‘input’ column or sheet.
Example:
If cell B2 has a formula like =A2*10, instead of writing to B2, write to A2.
Try this may help you!
When you use standard activities like “Write Cell” or “Write Range” in UiPath, they overwrite the entire cell content including any existing formulas. That’s why your formulas are getting erased when you pass values from one workbook to another.
Instead of writing directly into the formula cells, design your workflow to only update the cells that are meant for input, not those containing formulas.
Make sure your target workbook is structured with separate input cells and formula cells (avoid writing into the formula cells at all).
Hey @rahul.g can you try with scripting
Sub PasteValues()
Dim wsSource As Worksheet
Dim wsTarget As Worksheet
Dim sourceRange As Range
Dim targetRange As Range
Set your source and target worksheets
Set wsSource = ThisWorkbook.Sheets("Sheet1") ' Change as needed
Set wsTarget = ThisWorkbook.Sheets("Sheet2") ' Change as needed
Define the source and target ranges
Set sourceRange = wsSource.Range("A2:A10") ' Adjust as needed
Set targetRange = wsTarget.Range("B2") ' Starting point to paste
Copy values only (no formulas, no formatting)
targetRange.Resize(sourceRange.Rows.Count, sourceRange.Columns.Count).Value = sourceRange.Value
End Sub
Use an Invoke VBA activity.
Paste the code into a note and save the notepad as in(.vbs) extension
now use Excel Application Scope
Input: workbook path
Entry Method: PasteValues
cheers