I have a django server which allow user to upload xlsx files, I want to access the data in it.
I know about openpyxl, however, it looks like it doesn't have a way to parse opened files, I do not want to save the file on disk and read it again.
How can I do it?
Actually, it's simpler than above:
from openpyxl import load_workbook
...
if request.method == 'POST':
form = UploadForm(request.POST, request.FILES)
if form.is_valid():
wb = load_workbook(filename=request.FILES['file'].file)
The file
attribute of FILES['file']
already returns a BytesIO instance ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With