15 lines
489 B
Python
15 lines
489 B
Python
|
import os
|
||
|
|
||
|
def save_to_xlsx(project_name, file_name, data):
|
||
|
"""
|
||
|
Save data to an Excel file.
|
||
|
|
||
|
Args:
|
||
|
project_name (str): Name of the project (used for folder name).
|
||
|
file_name (str): Name of the file to save.
|
||
|
data (pandas.DataFrame): Data to save.
|
||
|
"""
|
||
|
os.makedirs(f'Result/{project_name}', exist_ok=True)
|
||
|
file_path = f'Result/{project_name}/{file_name}.xlsx'
|
||
|
data.to_excel(file_path, index=True)
|
||
|
print(f"Data saved successfully to {file_path}")
|