Is it possible to fill the form textboxes on the web page with the information in excel? There is a student information on each line in the Excel form and I want to fill each webpage textbox line with each Excel line.

Is it possible to fill the form textboxes on the web page with the information in excel? There is a student information on each line in the Excel form and I want to fill each webpage textbox line with each Excel line.

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Jul 11, 2023, 7:37 AM EDT
Check this
Make sure you have the ClosedXML library installed in your project. You can do this through NuGet by right-clicking on your project in Visual Studio, selecting "Manage NuGet Packages," and searching for "ClosedXML."
protected void btnPopulate_Click(object sender, EventArgs e) { string filePath = Server.MapPath("~/students.xlsx"); using (XLWorkbook workbook = new XLWorkbook(filePath)) { IXLWorksheet worksheet = workbook.Worksheet(1); int rowCount = worksheet.RowsUsed().Count(); // Assuming the first row contains headers, start from the second row for (int row = 2; row <= rowCount; row++) { string studentName = worksheet.Cell(row, 1).Value.ToString(); string studentAge = worksheet.Cell(row, 2).Value.ToString(); string studentGrade = worksheet.Cell(row, 3).Value.ToString(); // Create textboxes dynamically and populate them with student information TextBox txtName = new TextBox(); txtName.ID = "txtName_" + row; txtName.Text = studentName; form1.Controls.Add(txtName); TextBox txtAge = new TextBox(); txtAge.ID = "txtAge_" + row; txtAge.Text = studentAge; form1.Controls.Add(txtAge); TextBox txtGrade = new TextBox(); txtGrade.ID = "txtGrade_" + row; txtGrade.Text = studentGrade; form1.Controls.Add(txtGrade); // Add more textboxes for additional student information // Add line breaks between student information Literal ltBreak = new Literal(); ltBreak.Text = " "; form1.Controls.Add(ltBreak); } } }Mehmet FatihRank #1,474 · 1.1K reputationPosted Jul 11, 2023, 8:19 AM EDT
Thanks for your interest Amit. But I am getting some errors. Another point is that I don’t know where I will specify the web. The web link is this. ebelediye.kocaeli.bel.tr/KulturSosyal/KulturGeziBasvuru