How can I add a new row to an existing .xls file using PHPExcel?
Do I have to calculate the number of rows that already exist?
If so, how can I do that for an excel file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming this setup:
You can get the number of rows like so:
$num_rows = $objPHPExcel->getActiveSheet()->getHighestRow();Following this, you can look into inserting a row by using the following statement:
$objWorksheet->insertNewRowBefore($num_rows + 1, 1);This adds 1 new row before
$num_rows.