Skip to content

Commit 309126a

Browse files
committed
add xls and xlsx to supported formats
1 parent 1f3df6e commit 309126a

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

api/schema/resource_schema.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,6 @@ def _validate_file_details_and_update_format(resource: Resource) -> None:
144144
if not file_format:
145145
raise ValueError("Unsupported file format")
146146

147-
supported_format = [file_format]
148-
if file_format.lower() == "csv":
149-
data = pd.read_csv(file.path, keep_default_na=False, encoding="utf8")
150-
cols = data.columns
151-
for vals in cols:
152-
if vals == " " or vals == "Unnamed: 1":
153-
supported_format = []
154-
break
155-
elif not vals.isalnum():
156-
supported_format.pop()
157-
break
158-
159147
file_details.format = file_format
160148
file_details.save()
161149

api/utils/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# "application/ms-doc": "DOC",
1010
"application/pdf": "PDF",
1111
# "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "DOCX",
12+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "XLSX",
13+
"application/vnd.ms-excel": "XLS",
1214
"application/xml": "XML",
1315
"xml": "XML",
1416
"text/xml": "XML",

0 commit comments

Comments
 (0)