0

I have a excel having data like below:

Data.xlsx

Method_Name | Argument_01 | Argument _02
Func1       | val1        | val2
Func2       | val3        | val4

Now my question is:

How to read the function name and arguments from Data.xlsx file and invoke the method Func1 and pass the arguments (val1,val2) using python?

If provide me a code on that using python it would be very very helpful for me.

Thanks.

McGrady
  • 10,869
  • 13
  • 47
  • 69
Kuladip
  • 154
  • 1
  • 10

1 Answers1

1

To read a file is trivial. Just google it. Next, you can use eval(). Something like this.

def method1(val1):
    print(val1 + 1)

s1 = 'method1'
s2 = '99'
eval(s1 + '(' + s2 + ')')
# 100
Sangbok Lee
  • 2,132
  • 3
  • 15
  • 33