Re: Convert HTML Table to Tab Delimited .TXT file
| From: | Torsten Roehr | Date: | Mon, 24 May 2004 14:33:31 +0000 |
| Subject: | Re: Convert HTML Table to Tab Delimited .TXT file | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34536@lists.php.net to get a copy of this message | ||
<dpgirago@mdanderson.org> wrote in message
news:OFD9782EDE.9DCA2F68-ON86256E9E.004B834E-86256E9E.004F4E26@mdacc.tmc.edu
...
> Howdy All,
>
> I've PHP / Apache / MySQL running on a Linux machine where a GUI allows an
> administrator to track changes made to computers on our intranet. I've
> been asked to add an 'history' button so that all changes made to one or
> more computers can be put into a table, displayed on client machines
> (windows), then imported into an excel spread sheet. So far so good. I'm
> querying the dB, retrieving the requested records, then displaying in a
> new window in a table with border set to '0'. The expectation is that the
> admin on a client machine will then copy the table to a text file, then
> import into excel.
>
> The problem is with the field separator. I tried concatenating a '\t' to
> each field but this didn't behave as expected. Eventually, I concated a
> '|' (bar) character, and this imported with the correct formatting.
> However, now there is this foreign character at the end of each cell in
> the spread sheet.
>
> My question is whether there might be a more direct way to get the dB data
> into excel on the client PC (can't imagine how), or if not, how I might
> create a 'tab delimited' file from the HTML table and avoid introducing a
> foreign character as a field separator.
A comma seperated values file (.csv) should be readable by Excel. Just put a
; between all values and save it as a text file with .csv extension. I think
you don't need to go all the way via HTML output and copy/paste.
Hope this helps.
Regards, Torsten Roehr