如何使列从.xls中的列导入数据

时间:2016-03-31 10:40:24

标签: c# excel datagridview

我有一个从{.xls文件导入的docfile=request.FILES['docfile'] 。我使用from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from myproject.myapp.models import Document from myproject.myapp.forms import DocumentForm def list(request): # Handle file upload if request.method == 'POST': form = DocumentForm(request.POST, request.FILES) if form.is_valid(): docfile=request.FILES['docfile'] # Redirect to the document list after POST return HttpResponseRedirect(reverse('myproject.myapp.views.list')) else: form = DocumentForm() # A empty, unbound form # Load documents for the list page documents = Document.objects.all() # Render list page with the documents and the form return render_to_response( 'list.html', {'documents': documents, 'form': form}, context_instance=RequestContext(request) ) from django import forms class DocumentForm(forms.Form): docfile = forms.FileField( label='Select a file' ) 添加了一些列。

我现在要做的是列" ColumnName"从.xls中的列DataGridView导入数据。 以前我尝试使用datagrid中的DataTable符号添加列,但我无法引用列名。

0 个答案:

没有答案