Forum Discussion
orangebloss
Jul 16, 2025Copper Contributor
Setting Cell type format as V or L
I have an XLS that's been produced using python and two columns with dates in. Although the cell format is set to Date my upload to another system fails, investigation has found that this is because ...
Kidd_Ip
Jul 17, 2025MVP
You may consider one of the options which is Python:
To force cell type to "v" instead of "l":
- Use datetime objects instead of strings:
from openpyxl import Workbook
from datetime import datetime
wb = Workbook()
ws = wb.active
ws['A1'] = datetime(2025, 7, 17) # This will be treated as a value
wb.save("output.xlsx")
- If you write '2025-07-17' as a string, Excel sees it as a label ("l"). But if you use a datetime object, it becomes a value ("v").
- Set number format explicitly:
ws['A1'].number_format = 'YYYY-MM-DD'