I'd need to store an excel template in static resources, access to it, write dynamic data on it, and finally export it as a new file. I've looked up, but over a CSV parser, I haven't found anything useful. The question is : Is it possible? Because I'm not sure anymore. If yes, can you please explain me how? Do I need any libraries? I don't know what to do anymore. Thanks in advance

1 Answer 1


Manipulating things like .xlsx, .docx, and .pdf files is theoretically possible, but practically impossible (no standard functionality for doing zip/unzip on files, poor binary stream support, limited CPU and heap). That's not the type of work that the Salesforce platform is meant to do.

This is something that should be handled by another service. Heroku might be a decent fit since it gives you the ability to use other languages (which could have plugins/libraries to handle .xlsx files) and CPU/heap isn't nearly as much of a concern.

  • I do understand the heap limitations around these, but isn't csviterator and ImportCSVJob be good for the above usecase developer.financialforce.com/customizations/… and gist.github.com/martyychang/e133652e35bc6bd89ac3 Jan 11, 2021 at 14:05
  • @NagendraSingh I suppose it depends on whether or not OP is trying to manipulate csv files (which can be opened in excel) or .xlsx files (which can contain formulas, formatting, etc...). .xlsx files are comprised of a handful of files which are then zip compressed into a single file, and the actual spreadsheet itself is an XML document following the Open Document Format. Like I said, it's thoeretically possible to manipulate .xlsx files, but it'd take a ton of work and I'd be surprised if it could handle a file over 512 kB.
    – Derek F
    Jan 11, 2021 at 14:15

You must log in to answer this question.

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