Author Topic: Using xlcell for getting data  (Read 742 times)


  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Using xlcell for getting data
« on: December 13, 2013, 11:53:08 PM »
I am working on a foundation which would use the string generated from it to access the value of the cell. Is there a way to convert the string to xlcell type so that I can acess the value?

from pyxll import xl_func

@xl_func("xl_cell fst_add, int t, int p, float d: string", macro=True)
def deseason_odd(t, p, d):
    x = t - (p/2)
    y = t + (p/2)
    fst_add = "D"+str(x+1)   
    return "[value=%s]" %(fst_add.value)


  • Administrator
  • Hero Member
  • *****
  • Posts: 661
  • Karma: 15
    • View Profile
Re: Using xlcell for getting data
« Reply #1 on: December 14, 2013, 09:07:36 PM »

you can't get an XLCell object, but you can use the Excel COM api and get a Range object that has a Value property.

Use pyxll.get_active_object to get the Excel application object (see example, xl_app function). The you can do something like app.ActiveSheet.Range("A1") to get the range you want. If you want to get the sheet the function is called with you can use pyxll.xlfCaller.

Best regards,