0

It is necessary to transfer the dates from Excel columns to a .pdf report.

Using the xlrd module, the dates are displayed '2022-11-02 16:57'

Question: How to make a convenient and readable view of "02.11.22" from '2022-11-02 16:57'

My code:


import xlrd
from reportlab.pdfgen.canvas import Canvas

x = 63
y = 475

# Сбор данных с определенного столбца в Excel.
cells_date = tabl_list.col_slice(0, 1, 30)

# Отображение полученных данных из Excel в отчете .pdf
for cell_date in cells_date:
    canvas.drawString(x, y, cell_date.value)
    y -= 15

Даты выводятся в .pdf в таком формате:
enter image description here

I tried using "datetime", but I'm not an experienced programmer yet, so I decided to ask for help here.

Алексей Р
  • 7,507
  • 2
  • 7
  • 18

0 Answers0