Jspreadsheet Api

Headers

Set a column title

<?php
// Access token
$token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';

// Spreadsheet Guid
$guid = '15eb1171-5a64-45bf-be96-f52b6125a045';

// Create the client instance
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid);

// Result
$data = $spreadsheet->setHeader(0, 'New title');

print_r($data);

// Array ( [success] => 1 [message] => Updated [data] => )

Get all column titles

<?php
require 'vendor/autoload.php';

use jspreadsheet\Jspreadsheet;

// Access token
$token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';

// Spreadsheet Guid
$guid = '15eb1171-5a64-45bf-be96-f52b6125a045';

// Create the client instance
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid);

print_r($spreadsheet->getHeaders());

// ["New title","B","C","D","E","F","G","H","I","J"]

Get the title from a specified column number

<?php
require 'vendor/autoload.php';

use jspreadsheet\Jspreadsheet;

// Access token
$token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';

// Spreadsheet Guid
$guid = '15eb1171-5a64-45bf-be96-f52b6125a045';

// Create the client instance
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid);

// Result
print_r($spreadsheet->getHeaders(1));

// Array ( [1] => B )

Get multiple column titles

<?php
require 'vendor/autoload.php';

use jspreadsheet\Jspreadsheet;

// Access token
$token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';

// Spreadsheet Guid
$guid = '15eb1171-5a64-45bf-be96-f52b6125a045';

// Create the client instance
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid);

// Result
print_r($spreadsheet->getHeaders('1,2')); // Must be a string

// Array ( [1] => B [2] => C )