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 / Office Script Issue wi...
Power Automate
Unanswered

Office Script Issue with Power Automate help! Trying to clear a range in a table

(0) ShareShare
ReportReport
Posted on by 26

I have some data that I am cutting from one table and copying to another. I'd like to clear the tables and resize it when done.

 

I keep getting this error when trying to run to test my script prior to testing in Flow

Cannot read properties of undefined

 

 

 

function main(workbook: ExcelScript.Workbook) {
 let targetTable = workbook.getTable("Email Attestation");
 let hellorange = targetTable.getRangeBetweenHeaderAndTotal()
 hellorange.clear(ExcelScript.ClearApplyTo.contents);
 targetTable.resize("A3:I3");
}

 

 

 

 

here's the articles I've looked at - 

https://learn.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration

https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/excel-samples

https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-ranges-clear-delete

I feel like the above one is close but I need to refer to the range that the tables is currently occupying, but how?

https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables

https://learn.microsoft.com/en-us/office/dev/scripts/tutorials/excel-tutorial

 

Help! and Thanks!

 

Categories:
I have the same question (0)
  • Verified answer
    DynamicsGeek365 Profile Picture
    26 on at

    okay, I see an issue, it's the Table name

     

    let targetTable = workbook.getTable("Email Attestation");

     

    In the UI for Excel, you cannot have a table with spaces it had an underscore. This is helping me to understand the error messages. If you get "undefined name", it cant find the table you asked for. 

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard