Subject: Re: Can anyone share code for uploading csv or excel file to sqlite3
database.
I have tried this but not working
def upload_csv(request):
data = {}
if "GET" == request.method:
return render(request, "add_student/bulk.html", data)
# if not GET,
Is your template code correct? The form needs to have the following
property, otherwise uploading files won't work:
enctype="multipart/form-data"
Regards,
Andréas
Den tors 27 sep. 2018 kl 20:42 skrev BBG :
> I have tried this but not working
>
> def upload_csv(request):
> data = {}
>
There's blog article on Excel import here:
https://www.pythoncircle.com/post/591/how-to-upload-and-process-the-excel-file-in-django/
On Thursday, 27 September 2018 01:35:47 UTC+2, BBG wrote:
>
> I want to create upload bulk data. Can anyone share code to upload csv or
> excel file.
>
--
You
I have tried this but not working
def upload_csv(request):
data = {}
if "GET" == request.method:
return render(request, "add_student/bulk.html", data)
# if not GET, then proceed
try:
csv_file = request.FILES["csv_file"]
if not csv_file.name.endswith('.csv'):
Hi,
Have you studied the documentation of the CSV module included in Python
standard library ?
You'll find there all the needed information for reading and interpreting CSV
files without having to implement the raw parsing, and have there rows in a
form ready to use for inserting objects in
5 matches
Mail list logo