Update splitter.py
Browse files- splitter.py +6 -2
splitter.py
CHANGED
@@ -62,8 +62,12 @@ st.markdown(html_subject, unsafe_allow_html=True)
|
|
62 |
uploaded_file = st.file_uploader("", type=["csv", "xlsx"])
|
63 |
|
64 |
if uploaded_file is not None:
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
|
68 |
if 'Invoice_No' not in df.columns:
|
69 |
st.error("The uploaded CSV does not contain the 'Invoice_No' column.")
|
|
|
62 |
uploaded_file = st.file_uploader("", type=["csv", "xlsx"])
|
63 |
|
64 |
if uploaded_file is not None:
|
65 |
+
try:
|
66 |
+
# Try reading the CSV file with utf-8 encoding first
|
67 |
+
df = pd.read_csv(uploaded_file, encoding='utf-8')
|
68 |
+
except UnicodeDecodeError:
|
69 |
+
# Fallback to ISO-8859-1 encoding if utf-8 fails
|
70 |
+
df = pd.read_csv(uploaded_file, encoding='ISO-8859-1')
|
71 |
|
72 |
if 'Invoice_No' not in df.columns:
|
73 |
st.error("The uploaded CSV does not contain the 'Invoice_No' column.")
|