Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def save_list_as_excel(text):
|
|
36 |
return file_name
|
37 |
|
38 |
@st.cache_resource
|
39 |
-
def
|
40 |
try:
|
41 |
with open(file_path, 'rb') as file:
|
42 |
data = file.read()
|
@@ -51,7 +51,7 @@ def get_table_download_link(file_path):
|
|
51 |
mime_type = 'text/markdown'
|
52 |
else:
|
53 |
mime_type = 'application/octet-stream' # general binary data type
|
54 |
-
href = f'<a href="data:{mime_type};base64,{b64}"
|
55 |
return href
|
56 |
except:
|
57 |
return ''
|
@@ -115,9 +115,9 @@ def main():
|
|
115 |
df = pd.read_excel(file_name)
|
116 |
st.subheader("Saved Data")
|
117 |
st.dataframe(df)
|
118 |
-
st.markdown(
|
119 |
-
st.markdown(
|
120 |
-
st.markdown(
|
121 |
except:
|
122 |
pass
|
123 |
|
|
|
36 |
return file_name
|
37 |
|
38 |
@st.cache_resource
|
39 |
+
def get_download_link(file_path):
|
40 |
try:
|
41 |
with open(file_path, 'rb') as file:
|
42 |
data = file.read()
|
|
|
51 |
mime_type = 'text/markdown'
|
52 |
else:
|
53 |
mime_type = 'application/octet-stream' # general binary data type
|
54 |
+
href = f'<a href="data:{mime_type};base64,{b64}" download="{file_name}">{file_name}</a>'
|
55 |
return href
|
56 |
except:
|
57 |
return ''
|
|
|
115 |
df = pd.read_excel(file_name)
|
116 |
st.subheader("Saved Data")
|
117 |
st.dataframe(df)
|
118 |
+
st.markdown(get_download_link(file_name), unsafe_allow_html=True)
|
119 |
+
st.markdown(get_download_link(file_name.replace(".xlsx", ".csv")), unsafe_allow_html=True)
|
120 |
+
st.markdown(get_download_link(file_name.replace(".xlsx", ".md")), unsafe_allow_html=True)
|
121 |
except:
|
122 |
pass
|
123 |
|