Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import altair as alt
|
|
|
|
| 4 |
|
| 5 |
st.set_page_config(page_title="Shipment Monitoring Dashboard", layout="wide")
|
| 6 |
st.title("Shipment Monitoring Dashboard")
|
|
@@ -99,6 +100,20 @@ with tabs[0]:
|
|
| 99 |
sorted_df = filtered_df[['MAWB', 'ETA', 'ATA', 'Shipment Status', 'Cartons', 'Last Mile Carrier', 'Exception Note Description']].sort_values(by='ETA')
|
| 100 |
st.dataframe(sorted_df, use_container_width=True)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
with tabs[1]:
|
| 103 |
st.header("Upload CTN File for Last Mile Summary")
|
| 104 |
ctn_file = st.file_uploader("Upload Excel with Last Mile Service", type=["xlsx"], key="ctn_upload")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import altair as alt
|
| 4 |
+
import io
|
| 5 |
|
| 6 |
st.set_page_config(page_title="Shipment Monitoring Dashboard", layout="wide")
|
| 7 |
st.title("Shipment Monitoring Dashboard")
|
|
|
|
| 100 |
sorted_df = filtered_df[['MAWB', 'ETA', 'ATA', 'Shipment Status', 'Cartons', 'Last Mile Carrier', 'Exception Note Description']].sort_values(by='ETA')
|
| 101 |
st.dataframe(sorted_df, use_container_width=True)
|
| 102 |
|
| 103 |
+
# Export to Excel
|
| 104 |
+
excel_buffer = io.BytesIO()
|
| 105 |
+
with pd.ExcelWriter(excel_buffer, engine='xlsxwriter') as writer:
|
| 106 |
+
sorted_df.to_excel(writer, index=False, sheet_name='Shipment Details')
|
| 107 |
+
writer.save()
|
| 108 |
+
excel_data = excel_buffer.getvalue()
|
| 109 |
+
|
| 110 |
+
st.download_button(
|
| 111 |
+
label="📥 Download Shipment Details as Excel",
|
| 112 |
+
data=excel_data,
|
| 113 |
+
file_name="shipment_details.xlsx",
|
| 114 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
with tabs[1]:
|
| 118 |
st.header("Upload CTN File for Last Mile Summary")
|
| 119 |
ctn_file = st.file_uploader("Upload Excel with Last Mile Service", type=["xlsx"], key="ctn_upload")
|