Office Script - getRange / getWorksheet etc. - Error An internal error has occurred

Pratap Rajput 30 Reputation points
2023-10-01T08:52:47.7433333+00:00

Please refer the below script - when I run it on Excel Web - I get the error mentioned below.

Whereas I run the same script in Excel Desktop App - it works fine.

I have started getting this issue 28-Sep-2023. Earlier the script was working fine.

I request your quick support as my lot of work is on hold due to this & if Microsoft does not support us then I believe we should avoid using Microsoft Prodcuts due to such issue and no support.

function main(workbook: ExcelScript.Workbook) {
  let EmpList = workbook.getWorksheet("EmpList");
  let lastrowEmplist = EmpList.getTable("EmpList").getRowCount() + 3;
  EmpList.getRange("E4:H" + lastrowEmplist).copyFrom(EmpList.getRange("E2:H2"), ExcelScript.RangeCopyType.all, false, false);
}

Error:

Line 3: Workbook getWorksheet: An internal error has occurred.
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,657 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yutao Huang - MSFT 701 Reputation points Microsoft Employee
    2023-10-18T14:37:05.45+00:00

    UPDATE: The fix is now 100% in production. Please help to validate your code that has the range.copyFrom() API with ExcelScript.RangeCopyType.values as copyType. Thanks again for your patience!

    1 person found this answer helpful.