psjinx's blog

Parsing excel workbooks using Javascript

A Javascript library for parsing .xlsx files. It includes sample code along with demo for integration with AngularJS. Use cases include listing sheet names for selection in a form, showing preview of selected sheet etc.

Recently, I had to create a new web app, which would generate PDF reports based on data stored in excel worksheets. As usual, I used Django along with many other Python libraries for this.

It has following parts:

  1. HTML Form - To select excel files and upload it to server
  2. Parsing uploaded excel file - Basic validation followed by reading data from worksheets. I used xlrd module from Python-Excel project for this.
  3. Data analysis and plots - I used pandas, Python Data Analysis Library, and matplotlib, a python 2D plotting library, for this.
  4. PDF Generation - RML from ReportLab along with awesomeness of Django Templates seems suitable for this job. I used z3c.rml, an open source implementation of RML standard by Zope Foundation.

So, everything was working like a charm, except the fact that web app was reading data from first worksheet by index whenever an excel workbook was uploaded. But, user should be able to tell which worksheet to read from, right?

Read more ...

So, you want to create users using django-tastypie

Building a RESTful api for user registration using django-tastypie. It includes a github project for Django 1.5 style custom User model along with explanation for each step.

So lately, I have been thinking to write about what I learnt in past 5-6 months. I will force myself to write something fun and useful every once in a while, mostly related to Django for next few weeks.

I worked with django-tastypie for last 2-3 months to implement RESTful API for iOS applications. It involved implementation of an end point for creating new users.

This is not something which is really documented, so here I'm sharing my experience. In a nutshell, we need to override obj_create method of ModelResource and do some validation on posted data. After few iterations I ended up with a code which is easily maintainable with future relases of django-tastypie.


  1. Check if all required fields are set in posted data.
  2. Check if there is an existing user with same username or email address.
  3. Validate posted data (e.g. password validation).
  4. Set password from raw password.
  5. Hide raw password from response.

Let's dive in.

Read more ...

Page: 1 of 1

Follow Me

Subscribe To My Feed

While you're here, why not add my atom feed to your RSS reader or subscribe via email ?


django django-tastypie rest-api xlsxjs xlsx javascript excel workbook

Creative Commons License Using Jekyll, Pygments, Foundation | Sitemap