The issue I am having is I have a .xlsm workbook with two worksheets. One of the worksheets using a VLOOKUP macro function in a cell, that looks up a value in the second sheet in the workbook. I just need the date value that it defines from the VLOOKUP.
What I have tried:
-I used Openpyxl to open the existing workbook, using data_only=True, vba_values=True and the value keeps giving me '#N/A'
-I have tried using win32com to open the workbook, refresh the workbook and grab
the cell value, but I get this giant negative int -217589383
I am not sure if this is possible in openpyxl or if I am not using the library correctly. The macro in the cell looks like this '=VLOOKUP(A34,SSU!$1:$65536,2,FALSE)', the second sheet is called SSU.
I don't care which Python library I use in order to get the value that this macro calls, so long as I can get it. When I have a file that is .xls I am able to get that value easily using xlrd, but unfortunately, xlrd doesn't work with files that aren't .xls. Below is my code sample.
elif check_file_type(site_list_name, ['.xlsx', '.xlsm', '.xltx', '.xltm']) and get_file_name(
site_list_name) != prefix_suffix_file_name:
workbook = load_workbook(site_list_name_path, keep_vba=True, data_only=True)
worksheet = workbook.active
print(worksheet['B4'].value)
the print value is #N/A
Any suggestions would be greatly appreciated!!