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
salesforce mesalesforce me 

import the below 10.000records using the .csv(EXEL)file

<apex:page controller="importDataFromCSVController">
    <apex:form >
        <apex:pagemessages />
        <apex:pageBlock >
            <apex:pageBlockSection columns="4">
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Import Lead" action="{!importCSVFile}"/>
                  <apex:selectList label="Select User:"  value="{!selecteduserId}" size="1">
                  <apex:selectOptions value="{!UsersList}">
                  <apex:selectList value="{!selecteduserId}" size="1" multiselect="false"  >
                                          <apex:selectOptions value="{!ListOfUser}" />
        <apex:pageBlock >
           <apex:pageblocktable value="{!lList}" var="l">
              <apex:column value="{!l.Lastname}" />
              <apex:column value="{!l.Phone}" />
              <apex:column value="{!l.Company}" />
              <apex:column value="{!l.Email}" />


public with sharing class importDataFromCSVController {

    public String selecteduserId { get; set; }


    public List<User> UserTemp = new List<User>();
    public List<SelectOption> UsersList
            UserTemp = [Select u.LastName, u.Id, u.FirstName, u.Email From User u];
            UsersList= new List<SelectOption>();
            for(User temp : UserTemp)
                UsersList.add(new SelectOption(temp.Id, temp.LastName));
            return UsersList;

    public String getUsersList() {
        return null;

public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}
public List<Lead> llist{get;set;}
  public importDataFromCSVController(){
    csvFileLines = new String[]{};
    llist = New List<Lead>();
  public void importCSVFile(){
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n');
           for(Integer i=1;i<csvFileLines.size();i++){
               Lead lObj = new Lead() ;
               string[] csvRecordData = csvFileLines[i].split(',');
               lObj.Lastname = csvRecordData[0] ;             
               lObj.Phone = csvRecordData[1];
               lObj.Company= csvRecordData[2];
               lObj.Email= csvRecordData[3];   
               //accObj.Industry = csvRecordData[4];    
               lObj.OwnerId = selecteduserId;
        insert llist;
        catch (Exception e)
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
Are you asking a question or just posting some code for us to peruse at our leisure?