title: Excel import process in Asp.Net Mvc appears with the progress bar as much as the number of data in excel
body: <p>I want it to appear with the progress bar when the excel import process is completed in Asp.Net Mvc. The number of data I want in excel, the progress bar should progress as much as the number of data in excel. How can I do that? I have to solve it very quickly. Please can you help me?</p>
  <p>This is a snippet of my code:</p>
  <pre><code>        [HttpPost]
      public ActionResult Upload(FormCollection formCollection)
      {
  
          var mapList = new List&lt;AWSServerless_Google_Geocoding_Mvc.Models.Map&gt;();
          if (Request != null)
          {
              HttpPostedFileBase file = Request.Files[&quot;FileUpload&quot;];
              if ((file != null) &amp;&amp; (file.ContentLength &gt; 0) &amp;&amp; !string.IsNullOrEmpty(file.FileName))
              {
                  string fileName = file.FileName;
                  string fileContentType = file.ContentType;
                  byte[] fileBytes = new byte[file.ContentLength];
                  var data = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength));
                  using (var package = new ExcelPackage(file.InputStream))
                  {
                      ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
                      var currentSheet = package.Workbook.Worksheets;
                      var workSheet = currentSheet.First();
                      var noOfCol = workSheet.Dimension.End.Column;
                      var noOfRow = workSheet.Dimension.End.Row;
                      for (int rowIterator = 1; rowIterator &lt;= noOfRow; rowIterator++)
                      {
                          var map = new AWSServerless_Google_Geocoding_Mvc.Models.Map();
  
                          map.UserID = null;
                          map.Name = null;
                          map.Latitude = workSheet.Cells[rowIterator, 3].Value.ToString();
                          map.Longitude = workSheet.Cells[rowIterator, 4].Value.ToString();
                          map.Address = workSheet.Cells[rowIterator, 5].Value.ToString();
  
                          mapList.Add(map);
                      }
                  }
              }
          }
          using (LocationDBEntities db = new LocationDBEntities())
          {
              foreach (var item in mapList)
              {
                  db.Map.Add(item);
              }
              db.SaveChanges();
  
          }
          return RedirectToAction(&quot;Index&quot;, &quot;Home&quot;);
      }
  </code></pre>
  <p>This is a snippet of my javascript code:</p>
  <pre><code>var bar = $('.progress-bar');
  var percent = $('.percent');
  var status = $('#status');
  var files = $(&quot;#FileUpload&quot;).get(0).files;
  
  $('#Myform').ajaxForm({
      beforeSend: function () {
          $('#status').empty();
          var percentVal = '0%';
          $('.progress-bar').width(percentVal);
          $('.percent').html(percentVal);
      },
      uploadProgress: function (event, position, total, percentComplete) {
          for (var i = 0; i &lt; files.length; i++) {
              var percentVal = percentComplete + '%';
              $('.progress-bar').width(percentVal);
              $('.percent').html(percentVal);
          }
      },
      complete: function (xhr) {
          if (xhr.success == true) {
              setTimeout(function () {// wait for 5 secs(2)
                  swal({
                      title: &quot;Başarılı!&quot;,
                      text: &quot;Kayıt Başarılı!&quot;,
                      type: &quot;success&quot;,
                      showCancelButtonClass: &quot;btn-primary&quot;,
                      confirmButtonText: &quot;OK&quot;
                  });
                  location.reload(); // then reload the page.(3)
              }, 5000);
          }
      }
  });
  </code></pre>
  <p>Can somebody help me with this? Thanks :)</p>