Using PyHeaderFile to handle sheets
Fri 09 January 2015
Why working with Spreadsheets?
Spreadsheets are a 'proxy' between users and developers. With them, users can input data and organize things then send as input to systems, while programmers can handle these sheets and import or export from database for users.
Some good ways for users to handle spreadsheets are using Excel, Libreoffice, Google Drive and others. For the user is really simple to open a lot of formats and different extensions because these programs already do all hard work, but nobody take care of programmers (specially Python programmers)... We need to use a lot of difficult modules and find a way to read every strange spreadsheet format.
Why Python programmers can relax right now.
Yes, now Python community earned a module called PyHeaderFile! PyHeaderFile is an interface to handle sheets. No, not spreadsheets, but only sheets. Example of libreoffice sheet:
But why Sheets?
Sheets are beautiful! Spreadsheets are ugly... Spreadsheets add a lot of complexity when we handle it using Xlrd, Xlwt, Openpyxl, Pandas or even Python CSV (comma separated values) default module, but users usually use something different from commas to separate information in what I like to call as GWSV (guess what separated values). So you need to tell user: "send me in that format or I will kill you!"...
I remember when Microsoft changed default format from XLS to XLSX. The number of systems crashing because people don't know that extension and the number of help desk problems was (and continue) huge! So why not handle sheets as an easy way to programmer? The better approach is using sheets, because a CSV sheet can be handled exactly equal to XLS or XLSX or ODS sheet.
The main difference between sheets is style (programmers hate sheet styles, but users love), but programmers love simple data, not styles, colors, etc. By now PyHeaderFile can easily open CSV, XLS, XLSX files and convert between them (only data, no styles!). With PyHeaderFile you can open even physical files or memory files and convert between them too!
The only thing that users and programmers agree is that files are easier handled with a header. So, if:
Name, Date, Number Diogo, 1989-08-12, 7 Vivi, 1990-05-31, 27Users and programmers feel happy. If a file have a header you can handle this file with PyHeaderFile!