My code is as below, and the text.xlsx file looks like:
.
import xlwings as xw
import datetime
app = xw.App(visible=False,add_book=False)
file_path = r'D:\test.xlsx'
wb = app.books.open(file_path)
sht = wb.sheets[0]
cell = sht.range((1, 1)).value
print(cell)
wb.close()
app.quit()
In the test file, the datetime in 'A1' is (1895, 10, 24, 23, 2, 24), which stores in excel as -1528.96, but I don't care about this datetime right now, I just want to get the excel number -1528.96 in my code, but it failed.
The print message is:
1895-10-24 23:02:24
Expected meassage is:
-1528.96
Also tried: https://stackoverflow.com/a/9574948/12525445, but the result is -1527.04
Many thanks for any clue!