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 and Paste rows fr...
Power Automate
Suggested Answer

Copy and Paste rows from large dataset into another large dataset

(1) ShareShare
ReportReport
Posted on by
So I get a monthly .xlsm attachment emailed to me every month that has about 8k rows. I then manually copy + paste these rows into a masterfile (that has over 70k rows). I've created two flows to automate this process: 
 
Flow 1: When a new email arrives -> create a file (this then creates the monthly file in a sharepoint folder)  
Flow 2 (see pic below): When a file is created in sharepoint (file properties only) -> get file metadata (/identifier in the File parameter) -> run script 'Get data' (this grabs the data from monthly file and creates a json array, see pic below for more. Uses "@outputs('Get_file_metadata')?['body/Id']") -> run script 'how many chunks' (uses body/result from previous script, file parameter doesn't matter here, put any file) -> initialize variable called NumberofChunks (integer value, based on the body/result of 'how many chunks' script -> apply to each (range(1, add(variables('NumberofChunks'), 1))-> run script 'Paste Data' 

script for grabbing/getting the data: 

This results in array that looks like this in the body/result section: 
"{\"chunk 1\":[[\"1/5/2025\",\"example1@email.com\",\"\",\"123456\"],[\"1/18/2025\",\"example1@email.com\",\"\",\"123456\"],....\"chunk 161\":[[\"1/18/2025\",\"example1@email.com\",\"\",\"123456\"]]}"

The next script 'how many chunks' look like this: 
With the jsonOutput's input being body/result of the first script. This results in an integer for the body/result. 

Next script is the 'paste data' script: 
This pastes the script one at a time
 
THE PROBLEM:
While the above flows work fine when copy/pasting data into a smaller file (about 10k rows or so), the second flow fails at the very last step when trying to paste into a large file, like my masterfile that is about 70k rows. I get a '400' error with a message that says 'we were unable to run the script'. Ik that is not true as the flow works just fine on smaller files. It even worked on a file that had about 60k rows in it (albeit it took two hours to paste). I need help with the last step failing, how do I fix it? 

Note, if this flow is failing due to power automate size limits or something I can't control, then please help point me in another direction using power bi, macros, or something else that can help automate this copy/paste process. 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi
     
    It's impossible to read that stuff, sorry. As for trying to paste that many you would have to break it down you cannot paste that many. There is no machine-like memory when you do things locally, so you have to be able to run things within the resources you have (time outs for TCP connections etc etc). You need to break it down so that you can use a Do Until, loop through, do it in manageable chunks.
     
     
  • Suggested answer
    takolota1 Profile Picture
    4,974 Moderator on at
    There are 2 templates you may find very helpful…
     
    -Get Excel Sheet Data With Office Scripts
     
     
    -Excel Batch Update/Create/Upsert
    For your amount of data you will likely need version b of the batch script flow where it uses a Do until loop to add batches of Excel rows in chunks to a table.
     

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard