protected void Button1_Click(object sender, EventArgs e) { int sheet_number = Convert.ToInt32(TextBox1.Text); int column_number = Convert.ToInt32(TextBox2.Text); string cell_entry = ""; List<string> list_images = new List<string>(); foreach (Row row in (((Workbook.Worksheets(excel_path)).ElementAtOrDefault(sheet_number-1)).Rows)) { if (row.Cells.ElementAtOrDefault(column_number-1) != null) { cell_entry = (row.Cells.ElementAtOrDefault(column_number-1)).Text; list_images.Add(cell_entry); } } List<string> distinct_images = list_images.Distinct().ToList(); foreach (var images in distinct_images) { System.Drawing.Image image = DownloadImageFromUrl("https://media.loylty.com/Gallery/" + images + ".jpg"); if (image != null) { string rootPath = ConfigurationManager.AppSettings["FolderPath1"]; string fileName1 = Server.MapPath(rootPath + images + ".jpg"); image.Save(fileName1); } } }