function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ketan Solanki29Ketan Solanki29 

Visualforce page to export into excel ".xlsx" extension

Hi is there anyway to export into excel ".xlsx" extension using visualforce page.

 

I am using contentType = "application/vnd.ms-excel#MyFile.xlsx" but gives en error while opening a file.

 

Excel cannot open the file 'MyFile.xlsx' becuase the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

 

Please suggest me on this.

 

Thanks,

amarcuteamarcute

Try using

 

contentType = "application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet#MyFile.xlsx"
amarcuteamarcute

There is a typo in the first post.

 

contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet#MyFile.xlsx"
Ketan Solanki29Ketan Solanki29

Still not working for me!

abdelmunem almoradiabdelmunem almoradi
Change it to MyFile.xls (make the extension .xls instead of .xlsx) and it will work!
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12
Hi abdelmunem almoradi,

I have used the contentType = "application/vnd.ms-excel. but page only downloaded not display to Vf page.

Thank's..............
 
Chetankumar JainChetankumar Jain
is anyone able to accomplish this requirement?
We also have same requirement were we are able to export to ".xls" format using contentType="application/vnd.ms-excel" but not in ".xlsx".
Sascha DeinertSascha Deinert
Any news about this request?
Ravi Kumar 1094Ravi Kumar 1094
Is any update regarding the .xlsx format excel sheet generated through the VF page?
I am successfully able to generate the .xls format but can not able to generate the .xlsx file.