title: how to read excel file in memory (without saving it in disk) and return its content dotnet core
body: <p>Im working on a webApi using dotnet core that takes the excel file from IFormFile and reads its content.Iam following the article
  <a href="https://levelup.gitconnected.com/reading-an-excel-file-using-an-asp-net-core-mvc-application-2693545577db" rel="nofollow noreferrer">https://levelup.gitconnected.com/reading-an-excel-file-using-an-asp-net-core-mvc-application-2693545577db</a> which is doing the same thing except that the file here is present on the server and mine will be provided by user.</p>
  <p>here is the code:</p>
  <pre><code>  public IActionResult Test(IFormFile file)
          {
             List&lt;UserModel&gt; users = new List&lt;UserModel&gt;();
              System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
              using (var stream = System.IO.File.Open(file.FileName, FileMode.Open, FileAccess.Read))
              {
                  using (var reader = ExcelReaderFactory.CreateReader(stream))
                  {    
                      while (reader.Read()) //Each row of the file
                      {
                          users.Add(new UserModel
                          {
                              Name = reader.GetValue(0).ToString(),
                              Email = reader.GetValue(1).ToString(),
                              Phone = reader.GetValue(2).ToString()
                          });
                      }
                  }
              }
              return Ok(users);
          }
      }
  </code></pre>
  <p>When system.IO tries to open the file, it could not find the path as the path is not present. How it is possible to either get the file path (that would vary based on user selection of file)? are there any other ways to make it possible.</p>
  <p>PS: I dont want to upload the file on the server first, then read it.</p>