command to check if the sheet exist

Topics: User Forum
Sep 4, 2014 at 11:22 AM
Hello.

May I ask what is the script or command to check if the sheet is present or not?

Thanks.

Roggie
Coordinator
Sep 4, 2014 at 12:20 PM
$exists = $objPHPExcel->sheetNameExists('Worksheet 1');
    /**
     * Check if a sheet with a specified name already exists
     *
     * @param  string $pSheetName  Name of the worksheet to check
     * @return boolean
     */
Marked as answer by bogski on 9/9/2014 at 1:15 AM
Sep 9, 2014 at 9:05 AM
Edited Sep 9, 2014 at 9:15 AM
Thank you for your command. It seems to be working ok in my program. Thank you.
Coordinator
Sep 9, 2014 at 12:30 PM
On 09/09/2014 09:05, bogski wrote:
$exists = $objPHPExcel->sheetNameExists('Worksheet1');
If __Worksheet exist__ {

}
else
{
 printf "Worksheet does not exist"); 
}

    $exists = $objPHPExcel->sheetNameExists('Worksheet1');
    if ($exists) {
        printf "Worksheet exists"); 
    } else {
        printf "Worksheet does not exist"); 
    }

-- 
Mark Baker