Files
CollectMangaInfo/StoreXLS.py
2024-04-05 21:51:36 +09:00

74 lines
1.6 KiB
Python

import os
import time
from openpyxl import Workbook
from openpyxl import load_workbook
from openpyxl.utils import get_column_letter
xls_name = "mangaDB.xlsx"
list_MetaInfo = []
#
def GetCurrentTime():
# 현재 시간을 구하고 구조체로 변환
current_time_struct = time.localtime()
# 구조체에서 연, 월, 일, 시간, 분, 초를 추출
year = current_time_struct.tm_year
month = current_time_struct.tm_mon
day = current_time_struct.tm_mday
hour = current_time_struct.tm_hour
minute = current_time_struct.tm_min
second = current_time_struct.tm_sec
strRet = (f"{year}/{month}/{day}_{hour}:{minute}:{second}")
return strRet
# #
# def XLSWriteMangainfo(title, url, *tags):
# #
# try:
# wb = load_workbook(xls_path)
# print("Open Successed")
# except FileNotFoundError:
# wb = Workbook()
# print("xls Created")
# ws = wb.active
# # time, title, url, tags (comma)
# ws['A1'] = "Modified Time"
# ws['B1'] = int(time.time())
# if 'list' not in wb.sheetnames:
# ws1 = wb.create_sheet(title='list')
# print('list sheet created')
# wb.save(xls_path)
# ws2 = wb['list']
# # 폴더 경로
# folder_path = '/media/gerd/test/hiyobi_temp/'
# # 폴더 내의 파일 및 폴더 목록 가져오기
# items = os.listdir(folder_path)
# index = 2
# # 파일 및 폴더 목록 출력
# for item in items:
# pos = 'A' + str(index)
# ws2[pos] = item
# index += 1
# #print(item)
# print(str(index) + " searched")
# wb.save(xls_path)
# wb.close()