import os
import pandas as pd

# Path folder yang berisi data txt
label = 100
path = "pertalite_murni/"
# path = f"{label}/"

# Simpan Data
myData = []
for dir, folder, files in os.walk(path):
    # Menggabungkan setiap data dalam folder tertentu
    for file in files:
        df_temp = pd.read_csv(f"{dir}/{file}", delimiter=';')
        data_values = list(df_temp.columns)
        myData.append(data_values)

# 18 Kolom
columns = ['410nm', '435nm', '460nm','485nm',
           '510nm', '535nm', '560nm', '585nm',
           '610nm', '645nm', '680nm', '705nm',
           '730nm', '760nm', '810nm', '860nm',
           '900nm', '940nm']

# Simpan ke dalam CSV
df = pd.DataFrame(myData, columns=columns)
df['Label'] = label
df.to_excel(f"Fuel_Ron90{label}_new2.xlsx", index=False)


# import os
# import pandas as pd

# # Path folder yang berisi data txt
# label = 100
# path = f"{label}/"

# # Simpan Data
# myData = []
# for dir, folder, files in os.walk(path):
#     # Menggabungkan setiap data dalam folder tertentu
#     for file in files:
#         df_temp = pd.read_csv(f"{dir}/{file}", delimiter=';')
#         data_values = list(df_temp.columns)
#         myData.append(data_values)

# # 18 Kolom
# columns = ['410nm', '435nm', '460nm','485nm',
#            '510nm', '535nm', '560nm', '585nm',
#            '610nm', '645nm', '680nm', '705nm',
#            '730nm', '760nm', '810nm', '860nm',
#            '900nm', '940nm']

# # Simpan ke dalam Excel
# df = pd.DataFrame(myData, columns=columns)
# df['Label'] = label
# df.head()
# df.to_excel(f"Fuel_{label}_new.xlsx", index=False)




