Hello @Vignesh Babu Sundararajan ,
Just to make sure I understand your scenario correctly. In the script code you shared, I'm not seeing the part that does "pass this data to excel, delete the existing item, paste it in that table". I assume those operations are done directly in your Power Apps app, and then your app would invoke your Power Automate flow to run the Office Script to extract the chart image, right?
I'm guessing there might be a timing issue between the Excel Online operations in Power Apps (to prep the data in the table) and the operations in Power Automate (to extract the chart image). When the Run script action is trying to extract the chart image from the workbook, the changes made by the Excel Online the Power Apps haven't been fully propagated yet. These operations are from different "sessions" of Excel Online so there might be a synchronization among sessions in play here.
Do you think it's possible to move all the Excel related operations into the script? You can pass the original data all the way from Power Apps to the script and let the script to prep the table then extract the chart image. You will need to update your script code to accept parameter for the main
function.
You can also try to add some delay (like 30 seconds) in Power Automate flow, before the Run script action, and see whether that would help.
Please let me know how it goes!