Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using PHP to display calendar of events 3

Status
Not open for further replies.

abbottboi

IS-IT--Management
Nov 14, 2005
94
CA
Hi Smart People,

I would love to take an existing excel document and upload it to the web and have it displayed. This document currently shows row by row different events my not-for-profit organization holds with who's speaken etc. The value in having it display online would mean greater access to the information.

I have access to a web server and web space and is fimiliar with some coding should i need to change some things to make it work.

Any suggestions would be greatly appreciated.

Thanks
 
there is an output as html option in excel. could that be of use?
 
In ASP I've been able to read an Excel file using a recordset and connection just like a database. This is probably more difficult in PHP, but if your PHP is installed on a Windows server it should have the drivers available to connect in this way. If that's the case it is possible to process Excel files just like regular database recordsets.

If nothing else you could export it as a CSV and read that in with PHP as a textfile and process it with strings and arrays. I consulted for a friend who maintains a simple website for her school and she had a lot of trouble with the html generated by programs like Word and Excel -- it created pages that were very difficult to work with. My suggestion would be to find your easiest means of getting the data over to the web server and then create a page that processes it to display in your preferred method.
 
abbottboi,

Is the spreadsheet styled in any way? Borders, colors, different textsize etc? More than one tab?

If not, I would do the same as ecwcee -save as csv, then upload the csv and have a nifty little php script convert it into a html table.

Try saving your spreadsheet as csv - let's call it test.cvs.

Then put this script (index.php)
Code:
<?php

class flat_db {

  var $_separator;
  var $_db = false;

  function set_separator($str) {
    $this->_separator = $str;
  }

  function open_db($filename) {
    $this->_db = file($filename);
  }

  function close_db() {
    unset($this->_db);
  }

  function data_table() {
    echo "<table border=1>\n";
    foreach($this->_db as $record) {
      $record = rtrim($record);
      echo "<tr>\n";
      $fieldset = explode($this->_separator, $record);
      foreach($fieldset as $field)
        echo "<td>$field</td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
  }
}

$myDB = new flat_db;
$myDB->set_separator(";");
$myDB->open_db("test.csv");
$myDB->data_table();
$myDB->close_db();

?>

... and the test.csv file in the same folder on you server.

;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top