Dear AungUO,
Greetings! Thank you for posting in the Microsoft forum.
We understand you can refresh Power Pivot in Excel for the web using the Refresh Selected Connection button under Data tab, but you receive error when you perform the tasks Office Scripts.
Since the issue appears when you run the script, I suppose there must be some error in the script, to ensure you get the proper support, we will suggest you post in Microsoft Q&A forum under “office-scripts-excel-dev” tag.
The reason we are requesting you to post a new thread is that we have very little and limited knowledge and resources to help you with your request and in Microsoft Q&A (script forum), you will get the most qualified pool of respondents and other partners who read the forums regularly can either share their knowledge or learn from your interaction.
Thank you for your cooperation and understanding! Stay safe and stay healthy.
Sincerely,
Neha Singh | Microsoft Community Moderator
***Note: In the event that you're unable to reply to this thread, please ensure that your Email address is verified in the Community Website by clicking on Your Account Name > "My Profile" > "Edit Profile" > Add your Email Address > tick "Receive email notifications" checkbox > click on "Save".***