By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

embed excel or .csv in webpage

P: 45
hi all

is there anyway embedding excel or .csv files to the webpage other than the folowing two options

. saving it as a webpage
. using google docs

i used the following code, iam getting the .csv file in the page, but it would be good to have the color formatting, bold, italics... also in the webpage.

is it possible?

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.       $cnx = fopen("example.csv", "r"); //open example.csv 
  3.       echo("<table style='border:1px solid #ddd;'>"); // echo the table 
  4.       while (!feof ($cnx)) { // while not end of file 
  5.       $buffer = fgets($cnx); // get contents of file (name) as variable 
  6.       $values = explode(",", $buffer); //explode "," between the values within the  contents 
  7.       echo "<tr>"; 
  8.       for ( $j = 0; $j < count($values); $j++ ) {  // 
  9.       echo("<td style='border:1px solid #ddd;'>$values[$j]</td>"); 
  10.       } 
  11.       echo"</tr>"; 
  12.       }; 
  13.       echo("</table>"); 
  14.       fclose($cnx); //close filename variable 
  15.       ?>
  16.  
Jan 5 '12 #1
Share this Question
Share on Google+
3 Replies


100+
P: 1,059
if you want to create, read or update excel file then PHPExcel is a good choice
Jan 5 '12 #2

P: 45
i got one

http://code.google.com/p/php-excel-reader/

i tried PHPExcel too, but found too difficult to implement
Jan 5 '12 #3

100+
P: 1,059
try again, if I can then even a cat can do that
Jan 5 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.