Spreadsheet footers
Footers is the piece of readonly data that goes in the footer of the spreadsheet. It can be used to give a summary information, including formulas. A footer working example can be found here.
Documentation
Methods
The following methods are available to interact with the spreadsheet headers programmatically.| Method | Description |
|---|---|
| getFooters | Get the footers definitions for a spreadsheet
getFooters(): Promise<(string | null)[][] | []>
GET /api/:guid/footers
|
| setFooters | Set a defined names for a spreadsheet
setFooters(footer: (string | undefined | null)[][]): Promise<void>
@param footer - new footer data. POST /api/:guid/footers
|
| resetFooter | Set a defined names for a spreadsheet
resetFooter(): Promise<void>
DELETE /api/:guid/footers
|
| setFooterValue | Set a defined names for a spreadsheet
setFooterValue(x: number, y: number, value: string): Promise<void>
@param x - cell column to be changed. @param y - cell row to be changed. @param value - new cell value. POST /api/:guid/footers/value
|
Examples
Set the spreadsheet footers
NodeJS
PHP
import { Client } from '@jspreadsheet/client';
// Access token
const token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';
// Spreadsheet Guid
const guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Create a new client
const client = new Client(token);
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// New footer
const rows = [
['1', '2'],
['3', '4'],
];
// Create the footers from the array
spreadsheet.setFooters(rows).then(() => {
// It worked correctly
})
.catch((err) => {
// Something went wrong
console.log(err);
});
<?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
$rows = [
['1', '2'],
['3', '4']
];
// Create the footers from the array
$result = $spreadsheet->setFooters($rows);
// Result
print_r($result);
// {"success":1,"message":"Updated","data":null}
Retrieving all footers
NodeJS
PHP
import { Client } from '@jspreadsheet/client';
// Access token
const token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';
// Spreadsheet Guid
const guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Create a new client
const client = new Client(token);
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Get the footers
spreadsheet.getFooters().then((footer) => {
console.log(footer);
});
// [["1","2"],["3","4"]]
<?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); // Get the footers $result = $spreadsheet->getFooters(); // Result print_r($result); // [["1","2"],["3","4"]]
Set the value of a footer cell
NodeJS
PHP
import { Client } from '@jspreadsheet/client';
// Access token
const token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';
// Spreadsheet Guid
const guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Create a new client
const client = new Client(token);
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Set the value of the footer cell
spreadsheet.setFooterValue(1, 1, "New Value").then(() => {
// It worked correctly
})
.catch((err) => {
// Something went wrong
console.log(err);
});
Delete all footers
NodeJS
PHP
import { Client } from '@jspreadsheet/client';
// Access token
const token = 'MSwzMTJmZWQzMWYyYTI1OWQ5OGVhMWYxOWNhMDNhYWY3ZTA2ZmVmMWQz';
// Spreadsheet Guid
const guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Create a new client
const client = new Client(token);
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Delete the footer definitions
spreadsheet.resetFooter().then(() => {
// It worked correctly
})
.catch((err) => {
// Something went wrong
console.log(err);
});
<?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);
// Delete the footer definitions
$result = $spreadsheet->resetFooters();
// Result
print_r($result);
// {"success":1,"message":"Updated","data":null}