Skip to content

Insert data into the sheet without loading the whole spreadsheet file into memory.

License

Notifications You must be signed in to change notification settings

qazd/php-google-spreadsheet-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

143 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use

Create instance from CellFeedInsert providing WorkSheet you want insert to.

$spreadsheet = 'MyTable.xlsx';
$sheet = 'List1';

$service = new Google\Spreadsheet\SpreadsheetService();

$worksheet = $service->getSpreadsheets()
    ->getByTitle($spreadsheet)
    ->getWorksheets()
    ->getByTitle($sheet);
            
$cellFeed = new Google\Spreadsheet\CellFeedInsert($worksheet);

$batchRequest = new Google\Spreadsheet\Batch\BatchRequest();

$batchRequest->addEntry($cellFeed->createCell(2, 1, '111'));
$batchRequest->addEntry($cellFeed->createCell(3, 1, '222'));
$batchRequest->addEntry($cellFeed->createCell(4, 1, '333'));
$batchRequest->addEntry($cellFeed->createCell(5, 1, '=SUM(A2:A4)'));
$batchRequest->addEntry($cellFeed->createCell(100, 1, 'Very important cell'));

$cellFeed->insertBatch($batchRequest);

About

Insert data into the sheet without loading the whole spreadsheet file into memory.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%