This code appends to an already created Excel file:
FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls");
What can we add / modify so that Decrypted.xls should be created if not already created and appended if already created?
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.
According to the Javadocs for the String-accepting constructor of FileOutputStream, rover12, if the file doesn’t already exist then it’s created. Are you not seeing this behavior?
(And as others have mentioned, be sure to use the constructor that takes the second boolean argument so you can specify that you want to append the file if it already exists…)