> def about():
> import sys
> form = SQLFORM(db.excelform)
> from openpyxl import load_workbook
> wb = load_workbook(filename='filepath/excel.xlsx')
> sheet_ranges = wb['Sheet1']
> sheet_ranges['C4'] = form.vars.last_name
>
Close. Recall that you saved the submitted form data from the previous
request in session.vars -- so that's where you will find those values:
sheet_ranges['C4'] = session.vars.last_name
form = SQLFORM(db.excelform) is therefore unnecessary. With this line, you
are simply creating a fresh form object -- it doesn't know anything about
the form object you had created in the previous request to the excelform
function. Note that each request is independent of other requests, with the
models, controllers, and views executed in a new environment. You save
state from one request to the next via the session, cache, files, and the
database.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.