Exporting html table as csv

30 views
Skip to first unread message

mostwanted

unread,
Mar 25, 2022, 4:11:15 AMMar 25
to web2py-users
Is there a way to download data in my html table as csv?

I have information in an html table that comes from 4 different database tables but i want to have it downloaded to be used further in excel. Can i download this html table that i have combined all this information in as a single csv file with all this information?

Regards;

Murat KAŞIKÇIOĞLU

unread,
Mar 25, 2022, 7:05:54 AMMar 25
to web...@googlegroups.com
Hi,

You can use the javascript on HTML file like this:

If you want to read CSV and insert to db, you can check the codes in appadmin.py file on admin app.

Regards,
Murat.



mostwanted <godir...@gmail.com>, 25 Mar 2022 Cum, 11:11 tarihinde şunu yazdı:
Is there a way to download data in my html table as csv?

I have information in an html table that comes from 4 different database tables but i want to have it downloaded to be used further in excel. Can i download this html table that i have combined all this information in as a single csv file with all this information?

Regards;

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/05b0e270-acc0-4856-a9af-bb2acdf9fe48n%40googlegroups.com.

mostwanted

unread,
Mar 26, 2022, 5:24:06 AMMar 26
to web2py-users
Thanks alot Murat, gratitude

Dave S

unread,
Mar 30, 2022, 5:10:12 AMMar 30
to web2py-users

On Saturday, March 26, 2022 at 2:24:06 AM UTC-7 mostwanted wrote:
Thanks alot Murat, gratitude

Was 
of any help?  Are you creating a temporary table that you render the HTML from?

 

On Friday, March 25, 2022 at 1:05:54 PM UTC+2 muratkas...@gmail.com wrote:
Hi,

You can use the javascript on HTML file like this:

If you want to read CSV and insert to db, you can check the codes in appadmin.py file on admin app.

Regards,
Murat.



mostwanted <godir...@gmail.com>, 25 Mar 2022 Cum, 11:11 tarihinde şunu yazdı:
Is there a way to download data in my html table as csv?

I have information in an html table that comes from 4 different database tables but i want to have it downloaded to be used further in excel. Can i download this html table that i have combined all this information in as a single csv file with all this information?

Regards;

/dps
 

mostwanted

unread,
Mar 30, 2022, 11:37:29 AMMar 30
to web2py-users
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.

Dave S

unread,
Mar 31, 2022, 4:47:54 AMMar 31
to web2py-users
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.  

/dps


Reply all
Reply to author
Forward
0 new messages