Results 1 to 7 of 7

Thread: Is I possible to import information from an excel document to an HTML or email?

  1. #1
    Join Date
    Nov 2009

    Unhappy Is I possible to import information from an excel document to an HTML or email?

    Hello everyone. I work for a company that sends out weekly specials and offers in the form of an excel document. We are currently looking to design and create an email that will "pull" the information from that spreadsheet (that we will house on a server) so all the deals and specials will be directly in the email. And when the spreadsheet is updated each we we will replace the old one and the email will update with the new info on the excel doc.

    Is this something that is possible to do?! My boss is totally hounding me so any support would be awesome. Thanks so much!!

  2. #2
    Join Date
    Jun 2005
    United Kingdom
    It's possible server side - here's a method of doing it with asp.net. No doubt it can be done with php. Not really an HTML problem.

  3. #3
    Join Date
    Jul 2010
    I use python to handle excel spreadsheets (the only limitation is .xls , you can't use .xlsx (i didn't really check).

    python module: xlrd
    description: A Python module for extracting data from MS Excel ™ spreadsheet files.

    if you're on a shared server you can't install the module into the same root folder that python will be looking for it in, so you need to append the path and put your files into www/py/scripts and www/py/xlrd where www is the web root:

    from the shell:
    cat > XLS2HTML.py
    import sys
    sys.path.append( "/root_1/root_2/www/py/scripts" )
    sys.path.append( "/root_1/root_2/www/py/xlrd" )
    #             where root_1 and root_2 are directories from the server root (it needs to be an absolute path I think)
    from datetime import date,datetime,time
    from xlrd import open_workbook,xldate_as_tuple
    book = open_workbook('spreadhseets/weekly_specials.xls')
    #write function
    def w2html (str1ng):
    #end function list
    with open("outputhtml.html") as fyle:
        for name in book.sheet_names():
            print "<h1>" + name + "</h1>"
            print "<table>"
            for row_index in range(0,book.sheet_by_name(name).nrows):
                print "<tr> \n"
                for col_n in range(0,book.sheet_by_name(name).ncols): #i might have switched columns and rows around, this might make your sheet transformed 90 degrees lol)
                    print "<td>",
                    print name.cell(row_index,col_n)
                    print "</td>",
                print "</tr>"
            print "</table> \n"
    this will print all of the cells for each sheet into a separate html table (i think, didn't actually run it but if I don't get it first the right time.

    if you want it to write the code into the html file, change all of the print statements like this

    print "" will now become w2html("")

    hope this helps some, if you have dates inside of your xls file you need to convert them to a tuple first, like this

    sheet = book.sheet_by_name(name)
    cell = sheet.cell(row_index,col_n)
    date_value = xldate_as_tuple(sheet.cell(row_index,col_n).value,book.datemode)
    otherwise it will throw you a type error, if you want to ignore the dates, wrap the nested for loops inside a

    all the for loops here.


    I like it, if you're using enourmous xls file (like a gig or more) you should look into using on demand sheet calling. It's much much faster, but for my purposes using the above as a skeleton works.

    if you want to pass a value to the python script it will get stored in sys.argv[] (like a sheet name?)

    so calling python XLS2HTML.py week_8_menu.xls

    will put the value "week_8_menu.xls" in sys.argv[2] (maybe 1, i forget)

    that way you don't need to edit the python script using pico or nano

    php also has a way to let you open processes from a php script, you can read the process stream and it will echo all of the print lines in python or you can open the html table file that this script writes and echo the entire file (outputhtml.html). I actually use both, the process stream to show my users the error generated, and the htmlfile to show missing values inside the excel sheet. It lets them find errors in 30,000 rows of excel data very very fast, and having the data in an html table structure allows you to change it into an sql query with little effort.

    There is a module to write to excel sheets (xlwd i think), but why would you want to.

    good luck with the boss
    Hope this helps.
    Last edited by eval(BadCode); 08-11-2010 at 06:47 PM.

  4. #4
    Join Date
    Nov 2009
    Great thanks so much. It seems rather detailed. Is there a way to use XML if I were to convert?

  5. #5
    Join Date
    Jul 2010
    yes, but your spreadsheet would have to have some specific method to the madness and even then. You would probably need to parse the data, because people make mistakes.

    an HTML table is a hierarchical model.

    edit: replace (<table>,</table>,<tr>,</tr>,<td>,</td>) with your xml tags.
    I just showed you how I do this, I'd bet a pretty penny that the other poster has a perfectly workable method.
    But you will need a programming language or a program to convert a file. There is no html tag <xlsxtohtml src="weeklymenu.xlsx></xlsx>
    Last edited by eval(BadCode); 08-11-2010 at 07:33 PM.

  6. #6
    Join Date
    Aug 2010
    eava is used by hakers! some website was balck linked by this! just like some words "ugg" or "chanel coco"! it's also can get a good rank on google!

  7. #7
    Join Date
    Aug 2010

    the use of "clear:both;"

    A plain block level element without content, does not give raise to the creation of any inline box at all but still keeps its block box properties available for styling. The fact that there is no inline element content to be rendered results in a block box that "collapses" to whatever height that is specified as the browser default through the margin , padding and possibly border properties. A user «--» author style sheet can now cascade new values on top of the browsers ua.css default to give a visual effect of a "not existing" block box, leaving only the effect of 'clear:both;' as a visual result.
    This example page shows the "markup trick" in use and illustrates how to specify nested DIV elements to create an impression of content arranged as a table of data. You already have the source mark-up downloaded, since you are reading this right now. The corresponding stylesheet can be found here…
    I always like ugg boots but not adidas shoes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15970 seconds
  • Memory Usage 2,908KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (7)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (71):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates