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
karthikeya 2karthikeya 2 

Insert records using CSV File in Visual force page?

Hi All,

i am trying to insert records for Account using CSV File in Visual force page. But i am not able to insrt 200 records at a time.

I am trying with this refence link.
http://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/

Please help me to insert 6000 records in object.

Thanks in advance.
Richard Jimenez 9Richard Jimenez 9
Hi karthikeya 2,

Possibly a stupid question, but why are you not using the Data Import Wizard?

Thanks,
Richard.
karthikeya 2karthikeya 2
Its my requirement, i am using it for the custom object.
Richard Jimenez 9Richard Jimenez 9
Hi karthikeya,

The Data Import Wizard will import into custom objects.

I'm not entirely sure how you are using the example, but looking at the comments, there is a limit of 1000 records (the max collection size). Consider the following actions to help you narrow down where the issue is.
  • What are the errors you are getting - have you viewed the debug logs?
  • What is the size of the file? How many columns and rows are you importing?
  • If you reduce the file (cut in half), does it work?
  • Do you have any other code / triggers running?
  • Check the CSV file is formatted correctly in the way the code can read it. This code uses a very basic CSV parser that splits row by commas. The code will not handle correctly if your csv includes values containing commas or wrapped in double quotes (see https://en.wikipedia.org/wiki/Comma-separated_values for CSV definition )
Thanks,
Richard.