Application.CutCopyMode is not available in Excel office.js API. How can I stop paste values in cells in Excel Web Addin

Vikram Kumar 1 Reputation point
2022-05-04T04:26:40.023+00:00

I am working on a web addin using Office.js API. When I paste values in an range from external Excel file, the existing conditional formatting and other formatting get changed. I have two options; 1. Stop paste from external source and 2. Remove formats of source data and paste only values in the cells range. Please help/suggest me how I can perform these actions.

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yunfan Chen 6 Reputation points
    2022-05-11T13:02:10.677+00:00

    To my knowledge, CutCopyMode in excel addin is not supported now. You could go to Microsoft 365 Developer Platform Ideas Forum to see if this feature has already been requested or request a new feature.

    I would give you two workarounds.

    1. Set this sheet as protected. If user want to make change, only by your addin. (For the mainly read scenario)
    2. Clean and re-apply the conditional format manually or periodically. Use range.clear("Formats") and apply the conditional format again.

    Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.