Author Topic: XL cell Range in macros  (Read 511 times)


  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
XL cell Range in macros
« on: January 12, 2015, 05:06:07 AM »
When I use as in the Automation example to grab data from an XL sheet into my python code it works
however if I do something like
v=xl.Range("multiple cells range") I m not sure what type of data I m getting back in v
I was expecting and hoping for a numpy array but it seems not to be the case
when I print type(v)  I get <instance>
if I do this v=array(xl.Range("multiple cells range") I get probably an array but not sure under which form as ndim and shape return zero

Do you have any suggestions on how to do that?
for the moment I m going around this by running in VBA a PYXLL macro with parameters (hence data type is managed by the PYXLL decorator) : Run ("my python macro", param 1 , param 2 etc..)
But I would like to get rid of VBA code 100 %


  • Administrator
  • Hero Member
  • *****
  • Posts: 638
  • Karma: +15/-1
    • View Profile
Re: XL cell Range in macros
« Reply #1 on: January 13, 2015, 03:25:29 PM »

you're getting a Range object back. You need the Value property to get the value.

Docs for the Excel object model are on msdn here:

And specifically, the docs for the Range object is here:

I hope that helps,

Best regards,