I am trying to run below code.
require_once realpath(DIR . ‘/…/…/…/’) . ‘/vendor/autoload.php’;
use Aspose\Cells\CellsApi;
use Aspose\Cells\AsposeApp;
class Workbook {
public $cells;
public function __construct() {
    AsposeApp::$clientId = Utils::clientId;
    AsposeApp::$clientSecret = Utils::clientSecret;
    $this->cells = new CellsApi( AsposeApp::$clientId,AsposeApp::$clientSecret );
}
public function postImportDataCloudFile() {
    $name ='Book1.xlsx';
    $folder = "PhpTest";
    $data = new ImportIntArrayOption();
    $data->setDestinationWorksheet('Sheet1');
    $data->setFirstColumn(1);
    $data->setFirstRow(3);
    $data->setImportDataType('IntArray');
    $data->setIsVertical('true');
    $data->setData(array(1, 2, 3, 4)) ;
    $this->instance->uploadFile($folder + "/" +  $name , $sourceFolder + $name);
    $result = $this->instance->cellsWorkbookPostImportData($name, $data,  $folder);
}
}
try {
$workbook = new Workbook();
$workbook->postImportDataCloudFile();
} catch (Exception $e) {
echo  "Something went wrong: ",  $e->getMessage(), "\n";
PHP_EOL;
}
             
            
              
              
              
            
            
                
                
              
           
          
          
            
            
              In your shared Aspose Cells Cloud SDK source code on GitHub Util class is used.
require_once realpath(DIR . ‘/…’) . ‘/vendor/autoload.php’;
use Aspose\Cells\CellsApi;
use Aspose\Cells\AsposeApp;
class Workbook {
public $cells;
public function __construct() {
    AsposeApp::$clientId = Utils::clientId;
    AsposeApp::$clientSecret = Utils::clientSecret;
    $this->cells = new CellsApi( AsposeApp::$clientId,AsposeApp::$clientSecret );
}
public function postImportDataCloudFile() {
    $name ='Book1.xlsx';
    $folder = "PhpTest";
    $data = new ImportIntArrayOption();
    $data->setDestinationWorksheet('Sheet1');
    $data->setFirstColumn(1);
    $data->setFirstRow(3);
    $data->setImportDataType('IntArray');
    $data->setIsVertical('true');
    $data->setData(array(1, 2, 3, 4)) ;
    $this->instance->uploadFile($folder + "/" +  $name , $sourceFolder + $name);
    $result = $this->instance->cellsWorkbookPostImportData($name, $data,  $folder);
}
}
$workbook = new Workbook();
$workbook->postImportDataCloudFile();
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              @dev12scube,
We have updated the readme document for Aspose Cells Cloud SDK on Github.
Please check it.
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              @dev12scube
Example  Code:
require_once(‘vendor\autoload.php’);
use \Aspose\Cells\Cloud\Api\CellsApi;
use \Aspose\Cells\Cloud\Model\ImportIntArrayOption;
class Workbook {
public $cells;
public function __construct() {
$this->cells = new CellsApi( getenv("CellsCloudTestClientId"),getenv("CellsCloudTestClientSecret"),"v3.0",getenv("CellsCloudTestApiBaseUrl"));
}
public function postImportDataCloudFile() {
$name =‘Book1.xlsx’;
$folder = “Temp”;
$data = new ImportIntArrayOption();
$data->setDestinationWorksheet(‘Sheet1’);
$data->setFirstColumn(1);
$data->setFirstRow(3);
$data->setImportDataType(‘IntArray’);
$data->setIsVertical(‘true’);
$data->setData(array(1, 2, 3, 4)) ;
$sourceFolder = “.\data\”;
$this->cells->uploadFile($folder . “/” .  $name , $sourceFolder. $name);
 $result = $this->cells->cellsWorkbookPostImportData($name, $data,  $folder);
}
}
$workbook = new Workbook();
$workbook->postImportDataCloudFile();
             
            
              
              
              1 Like