I want to import data from excel sheets to the database in web2py. I wish 
to validate the excel sheet before importing data from it.My table 
structure is similar to 
db.define_table('xlsheets',Field('name'),Field('xl','upload'),Field('filename'))
>From this table, i will obtain the filename field using form.vars.fieldname 
after sqlform has uploaded the file. From this file, i wish to read the 
data and store to another table.
 Suppose the user has entered some wrong values or inappropriate data in 
the file, and we detect it after uploading it, I can not think of a way to 
undo the upload other than deleting the tuple and upload again.
 Hence to avoid this situation, I wish to validate the file by reading its 
values before uploading it.

Another question, I wish the transaction to be 'all or nothing' .i.e. 
either all rows of excel sheet get imported, or none must be. Can anyone 
suggest me how to do the rollback once an invalid tuple in excel sheet is 
obtained?

Reply via email to