On Wednesday, March 30, 2022 at 8:37:29 AM UTC-7 mostwanted wrote:

> Its a permanent html table in the view with information from different 
> database tables. From there i wanna download it as CSV to be used in excel 
> reports.
>

"Permanent html table" does make sense to me.  Permanent means it is kept 
in storage and not created during page rendering.

I find I can often use cut-and-paste to transfer something from a web page 
to a spreadsheet, but this may be awkward for large tables, and maybe not 
something you want to do everyday, much less once an hour.  On the other 
hand, saving the rendered html on the client machine makes it easy to run a 
script there that parses out the table.  I have a python script I use 
frequently, but it is also something you could do in an emacs or vim 
macro.  People who keep their vbasic skills up can do it as an Excel macro.

If you're creating the html from rows selected by a join, then the example's

with open('test.csv', 'wb') as dumpfile: rows.export_to_csv_file(dumpfile)

still works, and then you can have a button to download test.csv.  If more 
than one person is going to be collecting those results, you might want to 
have a distinguishing name, either appending username to the basename, or 
using the session id.  
(refers back to 
<URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-one-Table-at-a-time->

/dps


-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/53334a70-2929-4f4b-85a2-28584358dde4n%40googlegroups.com.

Reply via email to