web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Is it possible to use ...
Power Automate
Answered

Is it possible to use power automate desktop to paste a formula on excel?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

A formula on multiple docs is incorrect. I'm trying to replace the incorrect one with this one  =IF(G13=$K$5;5;IF(G13=$K$6;4;IF(G13=$K$7;3;IF(G13=$K$8;2;IF(G13=$K$9;1;)))))

 

Since I am pasting a formula, I created a new variable and set its value as the formula but get an error when I run it.

 

The error is "Failed to write to excel" and includes the detail below:

 

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to write into Excel. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.SetProperty(Object o, String propertyName, Object value)
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.WriteToExcel(Variant excelInstance, Variant startCol, Variant startRow, Variant valueToWrite, Int32 writeMode)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.WriteToExcel.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Wrong topic. Can't delete. Disregard.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Is this the same password protection issue as in the other post? Or are you getting this error even in an unprotected workbook?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This is on an unprotected excel file. 

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Instead of ‘write to Excel’

     

    Set to clipboard text %Formula%
    Then activate the cell you want to paste in

    Then Paste cells to Excel

     

    Here is mine, and it worked.  Ignore the 'Replace Text', we use commas instead of semi-colons.

     

    MichaelAnnis_0-1643724097874.png

    Good luck!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    You sir are a scholar and a gentleman! That worked! Thank you!

    Now, to figure a way around the protected sheet bit. 

    I've heard of power query. Any ideas if that would work on the protected sheet?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Use the UI elements for File Info, and you should be able to unlock the sheet somewhere there:

     

    https://support.microsoft.com/en-us/office/protect-an-excel-file-7359d4ae-7213-4ac2-b058-f75e9311b599

     

  • venkatesh340789 Profile Picture
    47 on at

    I have similar help required on update formula when i try to update formula in excel =Unique() through PAD its update in excel as =@unique. due to this i couldn't update formula in excel.

    venkatesh340789_1-1702279750875.png

     

    venkatesh340789_0-1702279380452.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 267 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 196

#3
Haque Profile Picture

Haque 182

Last 30 days Overall leaderboard