Split Excel Documents (PHP REST)

Skip to end of metadata
Go to start of metadata
This example allows you to split all or specific sheets of an Excel document and save each sheet as PDF, Image or any supported format using Saaspose.Cells REST API in your PHP applications.


SaasposeApp::$AppSID  = "77***************************";
SaasposeApp::$AppKey = "9a******************************";
SaasposeApp::$OutPutLocation = getcwd() . "\\Output\\";

//build URI to split sheets
$strURI = 'http://api.saaspose.com/v1.0/cells/Sample1.xlsx/split?format=png'; 

//sign URI
$signedURI = Utils::Sign($strURI);

$responseStream = Utils::processCommand($signedURI, "POST", "", "");
$json = json_decode($responseStream);

//iterate throug each document in the result to find output sheets
foreach ($json->Result->Documents as $splitSheet) { 
	$splitFileName = $splitSheet->link->Href;
	
	//build URI to download split sheets 
	$strURI = 'http://api.saaspose.com/v1.0/storage/file/' . $splitFileName;
	
	//sign URI
	$signedURI = Utils::Sign($strURI);

	$responseStream = Utils::processCommand($signedURI, "GET", "", "");
	//save output file
	$outputFile = SaasposeApp::$OutPutLocation . $splitFileName;
	Utils::saveFile($responseStream, $outputFile);
}

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.