mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 23:10:17 +00:00
Added xls detection.
This commit is contained in:
@@ -112,3 +112,11 @@ def dset_sheet(dataset, ws):
|
||||
ws.write(i, j, col)
|
||||
|
||||
|
||||
def detect(stream):
|
||||
"""Returns True if given stream is valid XLS."""
|
||||
|
||||
try:
|
||||
xlrd.open_workbook(file_contents=stream)
|
||||
return True
|
||||
except xlrd.XLRDError:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user