Part-Timer - 2014-01-14

Can you help me understand how to send and receive multi-dimensional lists
via PyCall?

Sending to a Python function:

Per you wiki example I'm able to send a simple list to a python method via
PyTuple (e.g. PyTuple("value1", "value2", "value3"). I can't figure out how
to send the following examples without breaking the array into it's
individual elements:

  • A single worksheet row passed to a Python function expecting a
    simple list. For example, passing
    PyTuple(Worksheets("Test").Range("A1").Value2,
    Worksheets("Test").Range("B1").Value2) works but passing
    PyTuple(Worksheets("Test").Range("A1:B1").Value2)) does not.

  • an array of arrays or multi-row spreadsheet range (e.g.
    Worksheets("Test").Range("A1:B5").Value2) passed as a list of lists

Could you post examples of how to do this?

Receiving from a Python function:

Your example is clear on how to receive a simple list via the
PyStr(PyGetItem. functions (e.g. Worksheets("Test").Range("A4:B4").Value2 =
PyVar(PyGetItem(res, "sorted")), but how you receive a multi-dimensional
list into a multi-row worksheet range? Could you post an example?

Thanks:

Thank you for creating this tool, the parts I have working are wonderful and
are fast! I was having freezing/crashing issues with Excel/VBA, and have
wanted to migrate to Python for some time and just use Excel for display and
ad hoc analysis and this tool enables me to do that.