Hello,
I have a problem with a simple import of a file after a form on my template.
I want the user to import an XLS file which I then convert to tuple for use.
Here is the template:
<form method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="InputFile" accept=".xls">
<input type="Submit" value="loadFile">
</form>
And in the view :
import pandas as pd
excelFile = request.FILES.get('InputFile')
csv_file = pd.read_excel(excelFile, header=None, engine='xlrd').replace(pd.np.nan,None).values.tolist()
The problem is that I observe unicode characters in some str and I don’t know how to remove them.
I find for example ‘BE\xa0BELGIUM\xa0BE\xa0BELGIUM\xa0MDPB\xa04201’
Do you think I have the right import method and do you have any ideas to solve this problem?
Thank you in advance