API Reference

Developers might want to set style and configuration for the sheet programmatically. For such cases SpreadSheet provides 2 classes:

Usage details

To start using the API libraries, take into account the following important thing:

  • your script file must contain at least 2 files included: api.php and config.php (the files reside in the 'php' folder at [YOUR_WEB_ROOT]/codebase/ directory).

Example

Let's assume that you name your script file as 'api_usage.php' and place it into 'php' folder. Then:

  • the file's location is:

spreadsheet/file_location.png

  • the file's content is:
//api_usage.php
<?php
 
require_once("api.php");
require_once("config.php");
 
$res = new PDO("mysql:dbname=$db_name;host=$db_host", $db_user, $db_pass);
 
$sh = new SpreadSheet($res, "1", $db_prefix);
 
$sh->setValue("B1", 1);
$sh->setValue("B2", "=B1-1");
$sh->setValue("B3", "=B2-2");
$sh->setValue("B4", "=B3-3");
 
?>
Back to top