You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
529 B

import os
import pandas as pd
class ExcelUtils:
file_path = 'output.xlsx'
@staticmethod
def red_excel():
if not os.path.exists(ExcelUtils.file_path):
return
# 从Excel文件中读取数据
data = pd.read_excel('output.xlsx')
return data
@staticmethod
def to_excel(data):
# 将数据转换为DataFrame
df = pd.DataFrame(data)
# 导出到Excel文件
df.to_excel(ExcelUtils.file_path, index=False)
print("导出成功!")