-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Lexerow is a backend dotnet library to process easily datarows and cells in Excel files (xlsx).
You can for example detect empty cell in a column and set a specific value. You can compare a cell value to a specific value and then put a new value in the same cell row or in another cell.
Lexerow is developed in C# and can be used in any dotnet application.
Lexerow is an open source library.
You have an Excel file containing a datatable: the first line is the header, and others are datarows of the table. In column B, some cells are empty, and it's a problem to do calculation. It would better to have a value in each cell.
So to put the value 0 in each empty cell in column B, Lexerow will help you to do that easily with some lines of code.
-1/ Create a script to fix cell values in the Excel datatable.
-2/ Execute the script in a C# program.
To process datarow of the excel file as explained, Lexerow provide a powerful instruction which is: OnExcel ForEachRow If/Then.
Let's consider the excel file to fix blank values is "MyFile.xlsx"
Create a basic script and save it "MyScript.lxrw"
# process datarow of the Excel, one by one
OnExcel "MyFile.xlsx"
ForEachRow
If B.Cell=null Then B.Cell=0
Next
End OnExcel
This a very basic script, but of course it's possible to create more complex script to manage different cases.
Create a program in C# and use the Lexerow library in this way:
// create the core engine
LexerowCore core = new LexerowCore();
// load and execute the script
core.LoadExecScript("MyScript", MyScript.lxrw);
This is the minimum C# program you have to write.