passing html table to cgi

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew

    #1

    passing html table to cgi

    I've been trying to find a way to gather up data contained in a table
    or tables on a previously generated html page in order to send it to a
    cgi for further processing. Ideally this would scrape the page for
    the tables' data (or even just those tables with more than 2 rows and
    2 columns) in a way that could be sent to the cgi using a form.
    Thanks for any help or pointers in the right direction.
  • Lee

    #2
    Re: passing html table to cgi

    Matthew said:[color=blue]
    >
    >I've been trying to find a way to gather up data contained in a table
    >or tables on a previously generated html page in order to send it to a
    >cgi for further processing. Ideally this would scrape the page for
    >the tables' data (or even just those tables with more than 2 rows and
    >2 columns) in a way that could be sent to the cgi using a form.
    >Thanks for any help or pointers in the right direction.[/color]

    How are you planning to use this? To extract data from pages that
    you visit on other sites, or from your own pages? In either case,
    it would probably be easier to do it on the server than in a web
    browser.

    Comment

    • Matthew

      #3
      Re: passing html table to cgi

      This would only be for my own pages. I've used an activex construct
      (included below) that scrapes tables out of the html and puts the data
      into an Excel spreadsheet. This works well if the end user has the
      right operating system/browser combination.

      In another context, I've used Perl with the Spreadsheet::Wr iteExcel
      and Spreadsheet::Pa rseExcel modules to generate Excel spreadsheets.
      So, I am hoping to be able to send the html tables to a Perl cgi where
      I can parse and write the data out to an Excel spreadsheet similiar to
      the activex method, but without the activex lack of portability.

      Here's the activex example (found this example somewhere, sorry I
      can't currently find where to correctly attribute):

      <A href=
      "javascript:(fu nction(){Ts=doc ument.getElemen tsByTagName('ta ble');
      if(!Ts)alert('N o%20tables.');e lse{try{X=new%2 0ActiveXObject( 'Excel.Applicat ion');X.visible =true;for(i=0;T =Ts[i];++i){Rs=T.rows ;if(Rs.length>1 &amp;&amp;Rs[0].cells.length>2 ){X.workBooks.a dd();for(r=0;R= Rs[r];++r){for(c=0;C =R.cells[c];++c){D=X.cells (r+1,c+1);
      if(r==0){D.enti reColumn.column Width=12;D.enti reColumn.vertic alAlignment=-4160;}D.value=C .innerText.repl ace(/\r/g,'');}}}}}catc h(e){alert('Cou ldn\'t%20open%2 0Excel.');}}})( );
      ">Download table to Excel</A><BR>

      thanks again for any help!

      Lee <REM0VElbspamtr ap@cox.net> wrote in message news:<buhmif0o2 g@drn.newsguy.c om>...[color=blue]
      > Matthew said:[color=green]
      > >
      > >I've been trying to find a way to gather up data contained in a table
      > >or tables on a previously generated html page in order to send it to a
      > >cgi for further processing. Ideally this would scrape the page for
      > >the tables' data (or even just those tables with more than 2 rows and
      > >2 columns) in a way that could be sent to the cgi using a form.
      > >Thanks for any help or pointers in the right direction.[/color]
      >
      > How are you planning to use this? To extract data from pages that
      > you visit on other sites, or from your own pages? In either case,
      > it would probably be easier to do it on the server than in a web
      > browser.[/color]

      Comment

      Working...