Hi All,

i have written a function that would send email and have an excel attachment. This function is working well but while receiving the email, i am unable to open the attachment, facing below error.

"Excel cannot open file X because the file format or file extension is not valid.Verify that the file has not been corrupted and the file extension matches the file."

The file content is got by converting an ListToExcel and storing this data in an entity, later i am retriving the stored content and passing it as FileContent for the AttachFile function.

Appreciate any help in figuring out the cause of error on opening attachment. Thanks.

Hi!

Have you verify if the content is correct, downloading it directly? 

Regards

Graça

Solution

MS Excel has the following observed MIME types:


  • application/vnd.ms-excel (official .xls)
  • application/msexcel
  • application/x-msexcel
  • application/x-ms-excel
  • application/x-excel
  • application/x-dos_ms_excel
  • application/xls
  • application/x-xls
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)

Try to use official mime type.


Thanks and Best Regards,

Nuno Pereira



Solution

Maria da Graça Peixoto wrote:

Hi!

Have you verify if the content is correct, downloading it directly? 

Regards

Graça

Hi,


i just created a screen to download the content from the saved entity. it is working well.


Nuno Gonçalo Pereira wrote:

MS Excel has the following observed MIME types:


  • application/vnd.ms-excel (official .xls)
  • application/msexcel
  • application/x-msexcel
  • application/x-ms-excel
  • application/x-excel
  • application/x-dos_ms_excel
  • application/xls
  • application/x-xls
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)

Try to use official mime type.


Thanks and Best Regards,

Nuno Pereira




Thanks this worked.