1

I am currently writing a lager script to ease my life.

Right now I am reading raw values from cells from an excel. So far so good.

These numbers need to be interpreted as seconds and then converted into minutes.

I tried my best with datetime but no luck.

Any suggestions?

elif auswahl == '2':
        print("Some user friendly-text:")
        excel_download = openpyxl.load_workbook(r'/Path/to/excel.xlsx')
        sheet = excel_download.active
        Grund_1 = sheet['B2'].value
        Grund_2 = sheet['B3'].value
        Grund_3 = sheet['B4'].value
        Grund_4 = sheet['B5'].value
        Grund_5 = sheet['B6'].value
        Grund_6 = sheet['B7'].value
        Zeit_in_Sekunden_1 = sheet['C2'].value
        Zeit_in_Sekunden_2 = sheet['C3'].value
        Zeit_in_Sekunden_3 = sheet['C4'].value
        Zeit_in_Sekunden_4 = sheet['C5'].value
        Zeit_in_Sekunden_5 = sheet['C6'].value
        Zeit_in_Sekunden_6 = sheet['C7'].value

        print("Du warst heute für", Zeit_in_Sekunden_1, Grund_1, "!")
        break

My idea:

raw_seconds_from_C2 = sheet['C2'].value

Then somehow convert to minutes from raw_seconds_from_C2

I am really out of ideas as I then need to put the converted minutes into a print().

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Sabri_1
  • 36
  • 3

1 Answers1

0

Divide the value by 60 to obtain minutes from seconds:

c2_minutes = sheet['C2'].value / 60

Thanks to @Alonso's comment on the question.

vvvvv
  • 25,404
  • 19
  • 49
  • 81