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
sunil_kumarsunil_kumar 

Downloading .csv file from static resource giving excel file.

Hi All,

 

I am storing a standard template(.csv file) which user can use to enter records and then they will upload file and then with the help of apex(controller) records will inserted in objects.

 

But the problem is when user download template from static resource its giving file in excel format but not in .csv format as file was stored in static resource as .csv format.

So can anyone help me with this issue and tell me where i am wrong?

 

Is there is any way to upload records by using excel file using apex(controllers)?

Best Answer chosen by Admin (Salesforce Developers) 
sunil_kumarsunil_kumar

Hi Vijay,

 

You want to store the .csv file in static resource and then you want download it in .csv format. If this is the case then instead of storing .csv file in static resource, store it in documents and then download it . It will give you file in .csv format.

 

If it works, please mark it as solution.

 

Thanks

Sunil Kumar 

All Answers

vijaymindvijaymind

Hi Sunil ,

Same problem here ! when I am putting fileName.csv in static resource and when download the extension I got .xls and all the column values are wraps in single column saparated by camma while I want all column values should be in different columns as I had .

please let me know if any suggestion !

 

Thanks

Vijay

 

sunil_kumarsunil_kumar

Hi Vijay,

 

You want to store the .csv file in static resource and then you want download it in .csv format. If this is the case then instead of storing .csv file in static resource, store it in documents and then download it . It will give you file in .csv format.

 

If it works, please mark it as solution.

 

Thanks

Sunil Kumar 

This was selected as the best answer
vijaymindvijaymind

Thank you very much sunil ,

 

It works fine . Thanks again.