Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Member not found error calling "formula" using Office 2019 #122

Open
vjain217 opened this issue Nov 19, 2024 · 3 comments
Open

Member not found error calling "formula" using Office 2019 #122

vjain217 opened this issue Nov 19, 2024 · 3 comments

Comments

@vjain217
Copy link

Issue is arising when trying to access named range variable in excel via xloil syntax as below:
book1.py ==>

import xloil as xlo
from debug import debug

class Book1():
    """
    Book1 model
    """
    def __init__(self):
        self.wb = xlo.active_workbook()
        named_ranges = []
        for name in self.wb.Names:
            debug(name.Name)
            named_ranges.append(name.Name)
            debug(self.wb[name.Name].formula)
        # self.directory = os.path.dirname(__file__)
        # self._workbook_name = os.path.basename(xlo.linked_workbook())  
       
b1 = Book1()

debug.py ==>

import inspect
from datetime import datetime
import os


def debug(*args):
    outfn = ( os.path.dirname(__file__) + '/temp' + str(datetime.now().year) + '-' + str(datetime.now().month) + '-' +
                  str(datetime.now().day) + '-' + str(datetime.now().hour) + 'h' + str(datetime.now().minute) +
                  'm.txt')
    #outfn = const.FILE_PATH
    tempout = open(outfn, 'a')
    stack = inspect.stack()[1]
    print(stack[2], stack[1], stack[3], file=tempout)
    tempout.close()
    if len(args) > 0:
       tempout = open(outfn, 'a')
       for item in args:
          print('\t', item, file=tempout)
       tempout.close()
    pass

above code, xloil error is coming as below in windows server:

xloil_error

PFB are the system specification & python libraries specification for Windows Server:
a. Windows Server 2022
b. 16GB RAM
c. 64 bit OS
d. Xloil -> Version - 0.19.x
e. Pywin32 -> Version – 308
f. Python -> 3.11.x
PFB are the system specification and python libraries specification for Local machine:
a. Windows 10
b. 16GB RAM
c. 64 bit OS
d. Xloil -> Version - 0.18.x
e. Pywin32 -> Version - 308
f. Python -> 3.11.x

Note: Debugging and tried solutions:

  1. Checked the name of variable used. Its already defined in excel.
  2. Uninstalled and Installed the Pywin32, 2 times using –no-cache-dir so that it downloads from the source ignoring the cache.
  3. Tried lowering the xloil version to 0.18.x as well.
  4. In excel under macros are enabled and access for developer setting is also checked.

Could you please help us in discovering the root cause of the issue & what can be the resolution or workaround of the issue?

PFA sample code which is working in local machine but not in windows server
Book1.zip

@cunnane
Copy link
Owner

cunnane commented Nov 20, 2024

My suspicion is that the version of Excel on the Win Server machine doesn't support dynamic arrays. Would it be possible to try in VBA to access the Formula2 property for a range on that machine? If that gives some kind of name not found error, I have a fix I can put in xlOil.

@vjain217
Copy link
Author

@cunnane , Thanks for your quick response!!

It was definitely an excel version issue in server Excel version of 2019 was installed. We will try to update the excel version in server. Thanks much :) !!

@cunnane
Copy link
Owner

cunnane commented Nov 20, 2024 via email

@cunnane cunnane changed the title Member not found error in windows server when accessing named variables in excel. Member not found error calling *formula* using Office 2019 Nov 21, 2024
@cunnane cunnane changed the title Member not found error calling *formula* using Office 2019 Member not found error calling "formula" using Office 2019 Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants