patto Posted July 14, 2006 Share Posted July 14, 2006 I have recently got a webpage PHP script and i am wanting the calculator that the script runs into an excell spreadsheet or a program can anyone offer any advice or what programs to use and/or what to do.THanx patto Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/ Share on other sites More sharing options...
hitman6003 Posted July 14, 2006 Share Posted July 14, 2006 What your asking doesn't really make sense. Please clarify.Unless you are using a Microsoft server and can use COM there is no want to output a .xls file. However, you can output a comma delimited file (CSV) that will open in Excel without COM. Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/#findComment-57692 Share on other sites More sharing options...
patto Posted July 14, 2006 Author Share Posted July 14, 2006 Sorry, lol new to this dont really know what to sayOk i have been using a website for a special calculator which gives you answers to catenary curves and i have emailed them asking for a copy for personal use and they have sent me the PHP scripted webpage and what i want to do is chage it from a webpage to a microsoft excel spreadsheet or somehow use the page they have sent me and set it up so the calculator works without the internet.i hope this makes more sense i believe this is the scripting that amkes the calculator works0)) $F = $_GET['F']; else $F = 0.674427074; if (isset($_GET['g']) && ($_GET['g'] + 0 > 0)) $g = $_GET['g']; else $g = 32.185039370; if (isset($_GET['q']) && ($_GET['q'] + 0 > 0)) $q = $_GET['q']; else $q = 0.00049999; if (isset($_GET['a']) && ($_GET['a'] + 0 > 0)) $a = $_GET['a']; else $a = 1.640419948; } // perform calculations in Imperial $H = $F/$g; $lambda = $H/$q; $x = (exp($a/(2*$lambda)) - exp(-$a/(2*$lambda))) / 2; $l = 2*$lambda*$x; $f = ($a/4)*sqrt(6*(($l/$a)-1)); $oF = $F; $F = $F*4.44822/(0.4536*0.3048); $sag = $lambda * (cosh($a/(2*$lambda)) - 1); $S = 2*$lambda*sinh($a/(2*$lambda)); $err = (($S/$a) - 1)*100; $F = $oF; if (($a == 0) or ($F == 0) or ($q == 0)) { $f = 0; $percent_error = 0; } else { $percent_error = ((($l/$a)-1)*100)/2; } // convert answers from metric to Imperial $l = $l/0.0254/12; $f = $f/0.0254/12; ?> and here is the link to the actual website calculator.http://www.spaceagecontrol.com/calccabm.htm Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/#findComment-57727 Share on other sites More sharing options...
hitman6003 Posted July 15, 2006 Share Posted July 15, 2006 You may want to check with the creator of the code to make sure that they will allow you to use it a different way.In order to do what you want...take that block of code and have it execute inside of an excel spreadsheet, you will have to rewrite it from php to vbscript, as a macro in excel. Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/#findComment-58226 Share on other sites More sharing options...
ShogunWarrior Posted July 15, 2006 Share Posted July 15, 2006 It mainly depends what the output is to be, if it's a spreadsheet grid then you can convert to Excel CSV, DIF or XML. XML gives you the most options without having to use anything other than standard PHP functions.If it's graphs etc. that you want in the spreadsheet then it's a bit of a different matter. Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/#findComment-58254 Share on other sites More sharing options...
Barand Posted July 15, 2006 Share Posted July 15, 2006 Adding a few linebreaks should clarify if. The first bit checks for valid input and substitutes default values where input is 0.The second bit shows the formulae for your cells.[code]<?phpif (isset($_GET['F']) && ($_GET['F'] + 0 > 0)) $F = $_GET['F']; else $F = 0.674427074; if (isset($_GET['g']) && ($_GET['g'] + 0 > 0)) $g = $_GET['g']; else $g = 32.185039370; if (isset($_GET['q']) && ($_GET['q'] + 0 > 0)) $q = $_GET['q']; else $q = 0.00049999; if (isset($_GET['a']) && ($_GET['a'] + 0 > 0)) $a = $_GET['a']; else $a = 1.640419948; } // perform calculations in Imperial $H = $F/$g; $lambda = $H/$q; $x = (exp($a/(2*$lambda)) - exp(-$a/(2*$lambda))) / 2; $l = 2*$lambda*$x; $f = ($a/4)*sqrt(6*(($l/$a)-1)); $oF = $F; $F = $F*4.44822/(0.4536*0.3048); $sag = $lambda * (cosh($a/(2*$lambda)) - 1); $S = 2*$lambda*sinh($a/(2*$lambda)); $err = (($S/$a) - 1)*100; $F = $oF; if (($a == 0) or ($F == 0) or ($q == 0)) { $f = 0; $percent_error = 0; } else { $percent_error = ((($l/$a)-1)*100)/2; } // convert answers from metric to Imperial $l = $l/0.0254/12; $f = $f/0.0254/12;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14548-php-to-excel-spreadsheet-help/#findComment-58467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.