2

I have requirements to implement the LWC file upload wizard which should handle very large size csv file( about 1 GB).. is it doable to parse such large size csv through APEX batch method?

I tried it after googling some help and it seems like, it reach to heap size limit. is there any work around for this problem?

Appreciate if someone can guide with sample code snippets or sample.

NOTE: Tried with but no luck https://developer.financialforce.com/customizations/importing-large-csv-files-via-batch-apex/

Thanks in advance !

1 Answer 1

3

No, Apex won't handle 1GB. A single string can be at most heap size in length (12MB for Batch Apex). Since you're using LWC, process the file client-side and pass the data in chunks to Apex. If you anticipate files of this size, you will want to read the file in chunks using File.slice as demonstrated in this Stack Overflow answer.

1
  • Thanks for valuable comments. Jun 8, 2020 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.