J'ai une table, construite en PHP qui affiche les résultats d'une table mysql.Télécharger les données du tableau HTML pour exceler
comme ceci:
$sql = mysql_query("SELECT * FROM survey");
echo "<table border='1'>
<tr>
<th>Question 1</th>
<th>Question 2</th>
<th>Question 3</th>
<th>Question 4</th>
<th>Question 5</th>
<th>Question 6</th>
<th>Question 7</th>
<th>Question 8</th>
<th>Question 9</th>
<th>Question 10</th>
<th>Question 11</th>
<th>Question 12</th>
<th>Question 13</th>
<th>Question 14</th>
<th>eMail</th>
</tr>";
while ($row = mysql_fetch_array($sql))
{
echo "<tr>";
echo "<td>" . $row['Question1'] . "</td>";
echo "<td>" . $row['Question2'] . "</td>";
echo "<td>" . $row['Question3'] . "</td>";
echo "<td>" . $row['Question4'] . "</td>";
echo "<td>" . $row['Question5'] . "</td>";
echo "<td>" . $row['Question6'] . "</td>";
echo "<td>" . $row['Question7'] . "</td>";
echo "<td>" . $row['Question8'] . "</td>";
echo "<td>" . $row['Question9'] . "</td>";
echo "<td>" . $row['Question10'] . "</td>";
echo "<td>" . $row['Question11'] . "</td>";
echo "<td>" . $row['Question12'] . "</td>";
echo "<td>" . $row['Question13'] . "</td>";
echo "<td>" . $row['Question14'] . "</td>";
echo "<td>" . $row['eMail'] . "</td>";
}
echo "</table>";
Ce que je veux faire est sortie ce tableau dans un fichier Excel, sans aucun code source ou balises de table. Y a-t-il un moyen de le faire? J'ai été submergé d'informations sur internet et je ne sais pas exactement ce dont j'ai besoin.
Si possible, je préférerais faire cela avec PHP, et sans bibliothèques supplémentaires.
Check out feuille de calcul Excel PEAR Writer http://pear.php.net/package/Spreadsheet_Excel_Writer/Il devrait faire ce dont vous avez besoin. –