fschwartzer commited on
Commit
dbe0802
1 Parent(s): 3a82f78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -259,10 +259,11 @@ with st.container():
259
 
260
  if st.button("Baixar arquivo do Excel"):
261
  with st.spinner('Downloading...'):
262
- filtered_data.to_excel("filtered_data.xlsx", index=False)
263
- # Generate a download link for the file
264
- with open('filtered_data.xlsx', 'rb') as file:
265
- st.download_button(label='Arquivo EXCEL', data=file, key='excel-download')
 
266
 
267
  folium_layermap = folium.Map(location=[custom_lat, custom_lon], zoom_start=zoom_level, control_scale=True)
268
 
 
259
 
260
  if st.button("Baixar arquivo do Excel"):
261
  with st.spinner('Downloading...'):
262
+ excel_file = filtered_data.to_excel("filtered_data.xlsx", index=False)
263
+ # Create a download link
264
+ b64 = base64.b64encode(excel_file.encode()).decode()
265
+ href = f'<a href="data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,{b64}" download="sample_data.xlsx">Download Excel File</a>'
266
+ st.markdown(href, unsafe_allow_html=True)
267
 
268
  folium_layermap = folium.Map(location=[custom_lat, custom_lon], zoom_start=zoom_level, control_scale=True)
269