Click to See Complete Forum and Search --> : HTML -> Excel?


vbjohn
01-04-2005, 08:58 AM
Is there a way in HTML that I can create a simple form and have a submit button. So when I fill out the form and hit the submit button it writes that data into a Excel Spreadsheet?

ray326
01-04-2005, 09:10 AM
No. You have to do that with the form handler.

vbjohn
01-04-2005, 09:21 AM
Where would I find something out on "form handler"?

ray326
01-04-2005, 09:26 AM
Well I'm pretty sure it's already done. I seem to recall a CGI++ library for doing all kinds of CGI-related tasks in C++. Search for mulitpart/form-data and C++ and plenty of code should appear.

NogDog
01-04-2005, 09:44 AM
I would think it would be quite simple to take the form data and output it to a CSV file (which is easily readable by Excel) with any server-side scripting/programming language. For example, in PHP, to ouput the data as a CSV file, I might do:

$csv = fopen('formdata.csv', 'w') or die("Error opening file formdata.csv for writing.");
$col=0;
foreach($_POST as $value)
{
if($col > 0)
{
fprintf($csv, ","); # print comma separator
}
if(preg_match("/[,\\"]/", $value)
{
# replace double-quote characters with 2 double-quotes and put
# entire expression within quotes:
$value = sprintf("\"%s\"", preg_replace("/\\"/", "\"\""));
}
fprintf($csv, $value);
$col++;
}
fprintf($csv, "\\n"); # add newline to end of line

vbjohn
01-04-2005, 10:46 AM
Originally posted by NogDog
I would think it would be quite simple to take the form data and output it to a CSV file (which is easily readable by Excel) with any server-side scripting/programming language. For example, in PHP, to ouput the data as a CSV file, I might do:

$csv = fopen('formdata.csv', 'w') or die("Error opening file formdata.csv for writing.");
$col=0;
foreach($_POST as $value)
{
if($col > 0)
{
fprintf($csv, ","); # print comma separator
}
if(preg_match("/[,\\"]/", $value)
{
# replace double-quote characters with 2 double-quotes and put
# entire expression within quotes:
$value = sprintf("\"%s\"", preg_replace("/\\"/", "\"\""));
}
fprintf($csv, $value);
$col++;
}
fprintf($csv, "\\n"); # add newline to end of line


PHP? I have never done that. Where should go to start reading up on it?

ggriffit
01-04-2005, 12:31 PM
Check out the following articles on the subject which should cover what you need :

http://www.greggriffiths.org/webdev/both/excel/
http://builder.com.com/5100-6373-5072712.html?tag=crm

NogDog
01-04-2005, 01:41 PM
Originally posted by vbjohn
PHP? I have never done that. Where should go to start reading up on it?
PHP (http://www.php.net/) is a programming language with a lot of built-in support for web applications. It is one of many such sever-side languages. To use any of them, they must be installed and configured on your web server.

PeOfEo
01-04-2005, 03:52 PM
You can easily write into spread sheets with asp and asp.net. It is very similar to using access, I mean you would still use an sql statement IIRC.


vbjohn what server side scripting does your server support?