Jump to content

embed excel or .csv in webpage


charles07

Recommended Posts

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?

 

<?php 
      $cnx = fopen("example.csv", "r"); //open example.csv 
      echo("<table style='border:1px solid #ddd;'>"); // echo the table 
      while (!feof ($cnx)) { // while not end of file 
      $buffer = fgets($cnx); // get contents of file (name) as variable 
      $values = explode(",", $buffer); //explode "," between the values within the  contents 
      echo "<tr>"; 
      for ( $j = 0; $j < count($values); $j++ ) {  // 
      echo("<td style='border:1px solid #ddd;'>$values[$j]</td>"); 
      } 
      echo"</tr>"; 
      }; 
      echo("</table>"); 
      fclose($cnx); //close filename variable 
      ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.