How to write a value defined in Power App into an Excel cell?
You have to:

Create Office Script like this

It works with a variable, whose value goes to the cell:

  • function main(workbook: ExcelScript.Workbook,
    myvalue: number
    ) {
    let selectedSheet = workbook.getActiveWorksheet();
    selectedSheet.getRange(“A1”).setValue(myvalue);
    }

Create a Power Automate flow

This flow calls the script with a value provided by Power Apps.

Power App running flow

The parameter of Run is a value provided by user, that will be written to a cell: