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

Need to be able to load a template file, and read and edit specific cells #465

Closed
wwendorf opened this issue Jun 11, 2015 · 3 comments
Closed

Comments

@wwendorf
Copy link

I have a problem with a project I am working on. I have to use specific excel templates file to send data via ftp to a 3rd part integration partner we are working with. The only format their system can accept is xlsx documents.

The problem is that they have lots of data above the column headers, so I basically need to be able to edit these files on a cell by cell basis. Can someone please give me a big of a code example so that I can target specific cells? Perhaps something like cell("B1") or row(5)->column(5)?

I've been looking thru the maatsoftware documentation and I can't seem to find anything specific on it. I found a reference to doing something like this with the phpOffice excel library, but am unsure how to call that via this library. I am using Laravel 4.2. My project was started before Laravel5 came out so I'm kinda stuck in the laravel 4.2 arena.

Thanks in advance for any help.

Wade

@patrickbrouwers
Copy link
Member

You can call the PHPExcel native methods in this package.
You can find the wrapper methods in our documentation: http://www.maatwebsite.nl/laravel-excel/docs/export#rows (sections Row & Cell manipulation)

@ichbinedgar
Copy link

Hi,

it was not too easy to find out, but I finally got it. I needed it to use var_dump(get_class_methods($reader)); many times until I found the correct method.

$reader->getExcel()->getSheet()->getCell('C7')->getValue() 
 \Excel::selectSheets('Configuration')->load($file->getRealPath(), function($reader) {              
        $reader->getExcel()->getSheet()->getCell('C7')->getValue() ;            
});

it might be useful to someone.

@wwendorf
Copy link
Author

Thanks All. I did find a method that worked for me too today.

$excel->getActiveSheet()->getCellByColumnAndRow($col-1, $row-1)->getValue()
and
$excel->getActiveSheet()->setCellValueByColumnAndRow($field[$key],$startRow+1,$value)

I wasn't able to get the getCell() function to work, but I will give your method a try.

Thanks!

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

No branches or pull requests

3 participants