Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xlwings as xw
- @xw.func
- @xw.arg('x', xw.Range)
- @xw.arg('y',xw.Range)
- @xw.arg('z',xw.Range)
- @xw.ret(expand = "vertical")
- def calc_scenario(x,y, z):
- address = x.address
- formula = x.formula
- res = []
- for scenario in y.value:
- x.value = scenario
- res.append(z.value)
- x.formula = formula
- return res
- import xlwings as xw
- sht = xw.Book("TestStuff.xlsm").sheets[0]
- def calc_scenario(x,y, z):
- address = x.address
- formula = x.formula
- res = []
- for scenario in y.value:
- x.value = scenario
- res.append(z.value)
- x.formula = formula
- return res
- x = sht.range("C43:H43")
- y = sht.range("C47:H49")
- z = sht.range("C45")
- calc_scenario(x,y,z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement