How <cfspreadsheet> to read a password protected excel file?
Copy link to clipboard
Copied
Hello All:
I tried to read password protected excel file by using this line of code
<cfspreadsheet action="read" query="MyControlPanelQuery" src="D:/LocalDocuments/FileName.xlsx">
I gave me this error "
An error occurred while reading the Excel: org.apache.poi.EncryptedDocumentException: The supplied spreadsheet is protected, but no password was supplied
"
I got this kind of error because the FileName.xlsx is password protected
The thing is "<cfspreadsheet action="read"....> doesn't any attribute to read a password protected excel file.
Any advice please?
Thank you
Copy link to clipboard
Copied
Use the "password" attribute to provide the password.
See the documentation for details.
Copy link to clipboard
Copied
The <cfspreadsheet action="read"....> doesn't have password attribute...but the <cfspreadsheet action="write"..> does.
This line
<cfspreadsheet action="read" query="MyControlPanelQuery" src="D:/LocalDocuments/MyControlPanelData.xlsx" headerrow="1" password="123">
give me this error:
Attribute validation error for tag CFSPREADSHEET. |
| It does not allow the attribute(s) PASSWORD. The valid attribute(s) are ACTION,COLUMNNAMES,COLUMNS,EXCLUDEHEADERROW,FORMAT,HEADERROW,NAME,QUERY,ROWS,SHEET,SHEETNAME,SRC. |
Copy link to clipboard
Copied
That sounds like a bug. Report it to Adobe and post your bug report number here so we can vote on it.
Copy link to clipboard
Copied
You are right, @pham_mn . I cannot get the password attribute to work with any of the actions <cfspreadsheet action="read">, <cfspreadsheet action="update"> and <cfspreadsheet action="write">. 😞
I have been testing on ColdFusion 2021 Update 2. What is your ColdFusion version?
Copy link to clipboard
Copied
I am using CF2016.
Thank you.
Also for some reason I don't receive notification via email any more
Copy link to clipboard
Copied
Pham, as for getting email notifications, have you enabled the settings for that at the bottom of the profile notifications tab? And is the email on the first tab correct?
Finally, are you sure that the emails are not blocked by some spam filter on your end or at your mail server?
/Charlie (troubleshooter, carehart. org)
Copy link to clipboard
Copied
The thing is "<cfspreadsheet action="read"....> doesn't any attribute to read a password protected excel file.
By pham_mn
Why do you say that? As @EddieLotter has said, cfspreadsheet has a password attribute. But, suppose Filename.xlsx is itself not password-protected. Then use as the value of the password attribute the password that offers read permissions D:/LocalDocuments.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Voted.
Copy link to clipboard
Copied
Thanks, @EddieLotter .