-1

I want to add data validation such that it allows only numbers.CLOSED XML

Sagar N H
  • 3
  • 1

1 Answers1

0

I think you can do it in memory but you can also use the "Data Validation" in Excel.

But if you use the Excel's data validation you need to be sure that the data you will insert programmatically are only number.

Anyway you can create an excel's templete file with the excel's data validation and than use closedXML for getting the file's template and then insert the data.

Basically for getting the template you can use this code(C#):

var workbook = new XLWorkbook("BasicTable.xlsx");

Info at : https://github.com/ClosedXML/ClosedXML/wiki/Loading-and-Modifying-Files

For the excel's data validation here there are some example : https://www.got-it.ai/solutions/excel-chat/excel-tutorial/data-validation/data-validation-how-to-allow-numbers-only

Marco
  • 86
  • 4