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
Shatrughna SalunkeShatrughna Salunke 

CSV, Excel and PDF file type is getting change after file downloaded

Hello ,

I am using apex class to send attchment of csv/excel file code is working fine, but once the I file downloaded from outllok or gmail  file type is getting change to File . But I can see these files are open in google sheet ,but not from the local drive after downloading 

I'm not sure  is it contentType issue or anything.

emailAttachment.setContentType('application/pdf');
or 
emailAttachment.setContentType('application/vnd.ms-excel');

Print 1: Attachment looks like below in gmail  
User-added image
Print 2: After file downloaded the file type is getting change to Flile.
User-added image


Thanks,
Shatrughna
ANUTEJANUTEJ (Salesforce Developers) 
Hi Shatrughna,

I would suggest you check if the issue is occurring only on your system or is it present on another system as well, if that is the case then the issue as mentioned could be with the two lines you stated, if not then the issue could be different.

Looking forward to your response.

Thanks.