开发者

Django Spreadsheet Application

开发者 https://www.devze.com 2023-04-11 02:08 出处:网络
I am in the making of a Django application where you will be able to upload an excel spreadsheet file and have it inserted into the application. But I sorta got the importingsorted out.

I am in the making of a Django application where you will be able to upload an excel spreadsheet file and have it inserted into the application. But I sorta got the importing sorted out.

What I need is a way to store the values dynamically, I basicly need X number of fields for each row, with each three possible types.

These would be:

  • Boolean
  • String
  • Number

How would I go about doing so? Let's say I have some models that contains this information:

A spreadsheet with a name, and some "header"-cells that will indidate which fields (and their name) that belong to that spreadsheet (but dynamically expanding).

A row that can have multiple cells, each with a type of either a boolean, a string or开发者_如何学JAVA a number.

An example could be like this:

Spreadsheet 100

  • name (string)
  • city (string)
  • religious? (boolean)
  • phonenumber (number)

and then I need to pair the cells underneath with the appropiate header, like this:

row

  • name = "Bob Curious"
  • city = "New York"
  • religious = "Yes"
  • phonenumber = "888 888 888"

I hope that explains it good enough, if not, please go ahead and ask for anything you might like explained.

Thanks in advance! :)


This post is pretty old so I'm not sure whether you still need help with your issue, but I've found xlrd to be an excellent tool for scraping spreadsheet data. I would suggest investigating this package further.


Maybe others would like to hear more about the solution for this question. My plugin django-excel would help with excel data import into and export from one or more django models. What's more, the plugin provides one programming interface to handle data in ods(using odfpy or ezodf), xls(using xlrd), xlsx(using openpyxl) and csv formats. I hope it may help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号