cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tobias-V
Regular Visitor

undefined clientRequestId: Excel Teams Sharepoint

Good Morning, 

i have a problem with my flow. 

i write a script that duplicate a worksheet, and rename it to the todays date. 

 

When i run the script in the Excel file, it will work.

i make a another copy of the file, and it worked there too, also works with power automate

but in the original file it wont work. and i have no idea why. 

 

Can someone explain me why? 

 

 

 

 

 

function main(workbook: ExcelScript.Workbook) {
	//Write current date in currentdate
	let currentdate: Date = new Date();

	//select last Worksheet
	let selectedSheet = workbook.getWorksheet("Leer_nicht_benutzen");

	// Duplicate worksheet
		let newSheet = selectedSheet.copy(ExcelScript.WorksheetPositionType.before, selectedSheet);
		
	// Rename worksheet to "current date"
	newSheet.setName(currentdate.toLocaleString('de-DE').slice(0, 10));
}

 

 

 

 

 

if i run it over power automate i get the following error. 

 

We were unable to run the script. Please try again.
Runtime error: Line 9: Cannot read property 'copy' of undefined
clientRequestId: 5b4efa89-569d-4f84-a0ce-0d67cd6eb0e2

 

i think the problem is here 

 
ExcelScript.WorksheetPositionType.before
 
but i am not sure why, because in a different file, it works. 
 
 
TobiasV_0-1669794327880.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tobias-V
Regular Visitor

Error is fixed, I made a stupid mistake. Sheet did not have the same name as in the code.

View solution in original post

1 REPLY 1
Tobias-V
Regular Visitor

Error is fixed, I made a stupid mistake. Sheet did not have the same name as in the code.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,271)