Reputation: 21
i'm really new with PHPExcel library,and i'm new with this kind of programming. So my problem is i just wanna read a cells with a value in it, and ignore all the empty cell below my tables. can i do that? My Excel file:
I know this question is simillar to this Ignore empty cells PHPExcel thread, but i can't find the answer there, so please can someone help me..
My code for converting excel:
Upvotes: 1
Views: 2251
Reputation: 850
Just add a validation inside the 2nd loop to check if all the required columns are empty, and if they're, skip that iteration. Example:
// Skip the iteration if all the required columns are empty
if(ltrim($aop_part_num) == '' && ltrim($type) == '' && ltrim($brand) == '' && ltrim($jumlah) == '') continue;
However, if the Excel file may have some more stuff below that table you're parsing (even if it has blank space in between), then replace the "continue" for a "break" to quit the loop and prevent that extra stuff from showing up in the echo statements.
Upvotes: 2