I need to merge cells in Excel (xlsx) by rows and again by columns using PHPExcel. I tried the following.
$sheet->mergeCells(\"G\".($row_count+1).\":G\".($row
Merging simply requires a valid range of cells like A1:B2, so your
$sheet->mergeCells("G".($row_count+1).":I".($row_count+1));
should work without any problem.
Can you please experiment with a simple test case to prove that this is causing you a problem, and not something else in your script
EDIT
After rereading your question: Your problem may be that you're trying to merge cells that are already part of a merge range, rather than merging each row, then trying to merge by column, try merging the full rangein one go.
$sheet->mergeCells("G".($row_count+1).":I".($row_count+4));