如何使用excel单元作为输入并在excel文件中再次将代码答案写为输出?

I have a code which gets an input then put it in a formula and at last gives an output. I want the my input value ($length) to be set from cell A2 of Sheet1 in the results.xlsx workbook which is located in the C:\Users\John\Desktop directory. It then puts the output value ($weight) in cell B2 in Sheet1. Can anybody complete my code?

I really dont need to read an array of inputs, just to read cell A2 and put the results in cell B2. Thank you. Here is my code:

<?php

$length=2;
$weight=$length*pi()/tan(0.03);

echo $weight;

?>

Paste in cell B2: =$A$2*PI()/TAN(0.03)