I would like to set up an email handler class to receive emails from a supplier with attached files in Excel format. We already have similar functionality that handles CSV attachments from another vendor.

Is it possible to parse attached Excel files in Apex, and/or convert to CSV for further processing? If so, how?

1 Answer 1


Short Answer: No its not posssible to read Excel in Apex.

Long Answer: Excel files(xls,xlsx etc) are not a text based file. They are binary files. Thus unlike CSV(text based) they cant be read line by line/character by character.

You would need a third party integration to convert your excel to CSV.

Meanwhile, there is an idea on Ideaxchange to provide Excel file reading and writing functionality in Apex.


If you still want to do that natievly in Salesforce you have to use an Outbound Integration like SQlizer which can convert your excel file into CSV file. Src: https://sqlizer.io/help/api

  • Actually, XLSX files might be readable, as there is Zippex, an Apex library for reading Zip files. Using that along with some basic XML parsing, you can do it. Files from the older XLS proprietary format, however, have no hope of being read, since there's no documentation on the format.
    – sfdcfox
    Commented Apr 4, 2018 at 22:32
  • Am trying Zippex to read XLSX files but am failing, can you guide me through? Commented Apr 5, 2018 at 8:09
  • It's only a theoretical, I've never gone through the entire process, but you might look at EMCA-376, Microsoft's Open Standard Office format they introduced about a decade ago.
    – sfdcfox
    Commented Apr 5, 2018 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .