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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copy Excel Data with f...
Power Automate
Unanswered

Copy Excel Data with formula and paste only values

(0) ShareShare
ReportReport
Posted on by 177

Hi,

 

I need to copy data from table of excel which having excel formula but paste only values in same excel in same rows and columns.

 

Please suggest!!

 

Thanks

Amit 

Categories:
I have the same question (0)
  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Hi @amsrivas ,

     

    Wondering if you would like to try out the new "Run script" action (included in the Excel Online (Business) connector):

    Yutao_0-1602015847816.png

     

    You'll first need to create your script (TypeScript) on Excel Online. Here is a sample script that copies values only from a table called "Table1" (which can contain formulas) to a range whose top-left cell is F11 on the worksheet called "Weekly Report":

     

     

    function main(workbook: ExcelScript.Workbook) {
     let sourceRange = workbook.getTable("Table1").getRangeBetweenHeaderAndTotal();
     let targetRange = workbook.getWorksheet("Weekly Report").getRange("F11");
     targetRange.copyFrom(sourceRange, ExcelScript.RangeCopyType.values);
    }

     

     

     

    Here are some links that might be helpful to learn more about the new Run script action and the Office Scripts in general:

    Hope this helps!

    Yutao

  • amsrivas Profile Picture
    177 on at

    Hi @Yutao , Thanks for the reply.

    But unfortunately, I do not have privilege to write any script on source file.

     

    Any suggestions!!

     

    Thanks

    Amit

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Hey @amsrivas ,

     

    You need to create/edit/record the script from inside Excel Online when a workbook is opened, but the script itself won't be saved into that workbook. Instead, it will be saved to your own OneDrive for Business.

     

    So if the Office Scripts feature is turned on in your organization/tenant (hopefully), you should be able to see the "Automate" tab. You can click on "Code Editor" to open up the script Code Editor pane.

    Yutao_0-1602022053265.png

     

    Then type in the script into the Code Editor pane. Save it with a meaningful name.

    Yutao_1-1602022075459.png

     

    After that, from the Run script action in Power Automate, you should be able to pick that script from the Script dropdown list.

     

    But if you're not seeing the "Automate" tab in Excel Online, that means your admin hasn't turned on Office Scripts for your organization yet. In that case, I guess you'll probably need to do some data wrangling with the other existing Excel Online (Business) actions like "List rows present in a table", "Update a row", "Add a row into a table", etc.

     

    Yutao

  • amsrivas Profile Picture
    177 on at

    Hi @Yutao 

     

    I will receive source file daily so i couldn't be able to write script everyday to the new file.

    Will it be done problematically using flows?

     

    Thanks

    Amit

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Hello @amsrivas ,

     

    You don't need to write script for every single workbook. You just need to write the script once and you can run it against any workbook you have access to.

     

    How do you pass the workbook you receive daily to the flow? Something like an email trigger or form submission trigger? You will need to properly configure your flow and the "Run script" action so it can work against dynamic workbooks.

     

    A script can accept parameters so it's also possible to pass in things like sheet name, table name, column index, conditions, etc. from the Run script action to direct the script do different things if you want to reuse a single script.

     

    Yutao

  • KK6387 Profile Picture
    2 on at

    HI Yutao,

    Good Day!

    I have tried the same but when calling the office script from Power Automate the new sheet is populating with #Name? instead of actual values. But the same script is working fine when I execute it from Excel. ExcelScript.RangeCopyType.values is not working as expected when triggering from Power Automate. Could you please help me with this issue?

     

    Regards,

    Karthik

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard