Author Topic: Returning Arrays  (Read 777 times)


  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Returning Arrays
« on: March 16, 2014, 04:21:40 AM »

I am new to this python package. This question was asked and I did a search of the forum however, I can figure out what I am doing wrong.

I have a very simple function:
Code: [Select]
from pyxll import xl_func

def test_func():

return [[1,2,3]]

When I run excel, Excel recognizes the function. Now, since this function is returning 3 numbers in an array to excel, I have to use the special cntl+shift+enter. So if I choose (highlight) cells A1:A3, press the "=" and enter in test_func() and then press cntl+shift+enter should I get three cell entries at 1,2,3? It doesn't work for me. It just returns zero. Something tells me there might be a numerical type issue or I'm just not using the excel array feature correctly. How can I get the array to return vertical? Iterate along rows instead of columns?

Thanks for reading.
« Last Edit: March 16, 2014, 04:24:18 AM by budder8818 »


  • Administrator
  • Hero Member
  • *****
  • Posts: 638
  • Karma: +15/-1
    • View Profile
Re: Returning Arrays
« Reply #1 on: March 19, 2014, 02:20:50 PM »

that function looks fine and should return 1,2,3 in adjacent cells if entered as you describe.

Have you checked the log file for any errors? Do the example array functions work?

If you want them to return vertically return [[1],[2],[3]].

Best regards,