Forum Discussion
chip1645
May 14, 2024Copper Contributor
Copying date from one sheet to another sheet using script.
I am using power automate to create a PDF of a worksheet and email to someone. Now the worksheet if populated by formulas. Therefore, when power automate pulls the worksheet to creat a PDF the data...
SergeiBaklan
Jul 05, 2025Diamond Contributor
Error 507 could have many reasons, in general that's incompatibility of applications running at the same time. Script could run another PDF conversion while previous one is not finished, or you work with protected mode, whatever.
It's not clear what script is doing for 2 minutes. For above code that's one second job. Do you run it from cloud flow or manually within workbook. Is workbook protected. If script are where other steps in it.
I'd tried also slightly modified version
function main(workbook: ExcelScript.Workbook) {
const dataRange = "A1:D18"
const source = workbook.getWorksheet("Tn8453").getRange(dataRange)
const target = workbook.getWorksheet("Report8453").getRange(dataRange)
const application = workbook.getApplication()
application.setCalculationMode(ExcelScript.CalculationMode.manual) // in general not necessary, just in case
target.copyFrom(source, ExcelScript.RangeCopyType.values)
target.copyFrom(source, ExcelScript.RangeCopyType.formats)
application.setCalculationMode(ExcelScript.CalculationMode.automatic)
}