Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export #17

Open
thiagoreri opened this issue May 28, 2019 · 2 comments
Open

Export #17

thiagoreri opened this issue May 28, 2019 · 2 comments
Labels

Comments

@thiagoreri
Copy link

Is there a possibility, of doing the process to the contrary, make a find in the table and write in the file? In the case it would be a data export

@robertpustulka
Copy link
Member

robertpustulka commented Jun 17, 2019

@thiagoreri

It is possible to dump the table into a spreadsheet file using your custom finder.

$table = TableRegistry::get('SomeTable');
$manager = new Manager();

$file = new File('your/file.xlsx');
$spreadsheet = $manager->getSpreadsheet($file);
$worksheet = $spreadsheet->getActiveSheet();

$manager->write($table, $worksheet, [
    'finder' => 'myFinder',
    'finderOptions' => [], //pass options to your finder
]);
$writer = $manager->save($spreadsheet, $file);

Check this method for reference: https://github.com/robotusers/cakephp-excel/blob/master/src/Excel/Manager.php#L154

@thiagoreri
Copy link
Author

IS possible export for empty file?

When trying to do this happens the following error:

Invalid cell cordinate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants