Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ st.markdown(styles, unsafe_allow_html=True)
|
|
| 38 |
|
| 39 |
# Custom gradient title
|
| 40 |
st.markdown("<h1>CSV appender</h1>", unsafe_allow_html=True)
|
| 41 |
-
st.write("A website that is used for appending multiple
|
| 42 |
|
| 43 |
# File uploader for multiple CSV files
|
| 44 |
uploaded_files = st.file_uploader("Upload CSV files", type="csv", accept_multiple_files=True)
|
|
@@ -75,32 +75,6 @@ if uploaded_files:
|
|
| 75 |
csv_output = BytesIO()
|
| 76 |
merged_df.to_csv(csv_output, index=False)
|
| 77 |
csv_output.seek(0)
|
| 78 |
-
|
| 79 |
-
# Define CSS styles for the button
|
| 80 |
-
button_styles = """
|
| 81 |
-
<style>
|
| 82 |
-
div.stButton > button {
|
| 83 |
-
color: #ffffff; /* Text color */
|
| 84 |
-
font-size: 50px;
|
| 85 |
-
background-image: linear-gradient(0deg, #a689f6 3%, #413bb9 61%);
|
| 86 |
-
border: none;
|
| 87 |
-
padding: 10px 20px;
|
| 88 |
-
cursor: pointer;
|
| 89 |
-
border-radius: 15px;
|
| 90 |
-
display: inline-block;
|
| 91 |
-
}
|
| 92 |
-
div.stButton > button:hover {
|
| 93 |
-
background-color: #00ff00; /* Hover background color */
|
| 94 |
-
color: #ff0000; /* Hover text color */
|
| 95 |
-
}
|
| 96 |
-
</style>
|
| 97 |
-
"""
|
| 98 |
-
|
| 99 |
-
# Render the button with the specified styles
|
| 100 |
-
st.markdown(button_styles, unsafe_allow_html=True)
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
st.download_button(
|
| 105 |
label="Download Merged CSV File",
|
| 106 |
data=csv_output,
|
|
@@ -115,37 +89,11 @@ if uploaded_files:
|
|
| 115 |
with pd.ExcelWriter(excel_output, engine='xlsxwriter') as writer:
|
| 116 |
merged_df.to_excel(writer, index=False)
|
| 117 |
excel_output.seek(0)
|
| 118 |
-
|
| 119 |
-
# Define CSS styles for the button
|
| 120 |
-
button_styles = """
|
| 121 |
-
<style>
|
| 122 |
-
div.stButton > button {
|
| 123 |
-
color: #ffffff; /* Text color */
|
| 124 |
-
font-size: 50px;
|
| 125 |
-
background-image: linear-gradient(0deg, #a689f6 3%, #413bb9 61%);
|
| 126 |
-
border: none;
|
| 127 |
-
padding: 10px 20px;
|
| 128 |
-
cursor: pointer;
|
| 129 |
-
border-radius: 15px;
|
| 130 |
-
display: inline-block;
|
| 131 |
-
}
|
| 132 |
-
div.stButton > button:hover {
|
| 133 |
-
background-color: #00ff00; /* Hover background color */
|
| 134 |
-
color: #ff0000; /* Hover text color */
|
| 135 |
-
}
|
| 136 |
-
</style>
|
| 137 |
-
"""
|
| 138 |
-
|
| 139 |
-
# Render the button with the specified styles
|
| 140 |
-
st.markdown(button_styles, unsafe_allow_html=True)
|
| 141 |
-
|
| 142 |
-
# Provide a download button for the Excel file
|
| 143 |
st.download_button(
|
| 144 |
-
label="Download Excel",
|
| 145 |
data=excel_output,
|
| 146 |
file_name="merged_data.xlsx",
|
| 147 |
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 148 |
)
|
| 149 |
-
|
| 150 |
else:
|
| 151 |
-
st.write("
|
|
|
|
| 38 |
|
| 39 |
# Custom gradient title
|
| 40 |
st.markdown("<h1>CSV appender</h1>", unsafe_allow_html=True)
|
| 41 |
+
st.write("A website that is used for appending multiple csv files and converting them to excel format")
|
| 42 |
|
| 43 |
# File uploader for multiple CSV files
|
| 44 |
uploaded_files = st.file_uploader("Upload CSV files", type="csv", accept_multiple_files=True)
|
|
|
|
| 75 |
csv_output = BytesIO()
|
| 76 |
merged_df.to_csv(csv_output, index=False)
|
| 77 |
csv_output.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
st.download_button(
|
| 79 |
label="Download Merged CSV File",
|
| 80 |
data=csv_output,
|
|
|
|
| 89 |
with pd.ExcelWriter(excel_output, engine='xlsxwriter') as writer:
|
| 90 |
merged_df.to_excel(writer, index=False)
|
| 91 |
excel_output.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
st.download_button(
|
| 93 |
+
label="Download Merged Excel File",
|
| 94 |
data=excel_output,
|
| 95 |
file_name="merged_data.xlsx",
|
| 96 |
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 97 |
)
|
|
|
|
| 98 |
else:
|
| 99 |
+
st.write("")
|