This exception is basically generated when PHPExcel is unable to write to the specifi file or write to the directory that will contain the file, so to troubleshoot this problem you may want to follow these steps:
- Check that the directory that you are trying to write exists. You may do this with a tool, via CLI or even with a conditional statement in PHP.
- Permissions problems. If the file exists, check if the user that executes the script has access to the directory where the file should be written to (have the open_basedir in count).
- Block issue when the file has been opened by another application.
- Disk space problem, if the disk that you are tryng to write the file doesn't have available space, you will be unable to create the file.
Is important that you follow the steps in the given order until you find out what's the reason why the file cannot be created.
Happy coding !