(Hopefully this pic shows up)

So i’m trying to make an algo but it’s a little too advanced for what i know so far. If you see the excel cells in the pic each cell going across is the next month of options on a stock. The 3 cells going down are different options. What i’m telling it is each cell is valuing the time value between that one and the one before it. So it doesnt show August but its assume thats the first month. If we just look at the 15 line its saying that november is worth .02 more than aug…andDec22 is worth .30 more than JUN…So Dec22 is worth all of them added together back to wherever…Dec22 is worth .58 more than JAN… In the end then if any of the months line up less than my values it will autmatically buy the spread. Does anyone have any idea how something like this would look in a script?