Hi @BeyondMyself,
thanks for your answer!
In my case the problem is that I do not know beforehand whether the file will be CSV or xlsx.
Since (I suppose) csv and excel files have a different encoding, I suppose that something bad happens in my encoding function
try:
bytesData = uploadedFile.getvalue()
encoding = encodingUTF8
s=str(bytesData,encoding)
result = StringIO(s)
I do not get an error here, but then when I run “read_excel” on the object returned from my “StringIO(s)” function, I get the error.
try:
df = pd.read_excel(dataUploaded)
except:
df=pd.DataFrame()
Are you saying that filename=uploaded_file.name will give me also the file suffix (csv or xlsx) not just the file name ?
Thanks again!
Fabio