@manhng

Welcome to my blog!

EPPlus

September 13, 2017 21:26

EPPlus (edit)

Insert Formula in Cell using C# (OpenXML and EPPlus Library)

https://stackoverflow.com/questions/13772659/copying-a-formula-and-applying-it-to-a-new-cell-range

https://nishantrana.me/2017/04/11/insert-formula-in-cell-using-c-openxml-and-epplus-library/

https://community.dynamics.com/crm/b/nishantranaweblog/archive/2017/04/11/insert-formula-in-cell-using-c-openxml-and-epplus-library

https://www.paragon-inc.com/blog/easy_excel_interaction_pt1

https://www.paragon-inc.com/blog/easy_excel_interaction_pt2

https://www.paragon-inc.com/blog/easy_excel_interaction_pt3

https://www.paragon-inc.com/blog/easy_excel_interaction_pt4

https://www.paragon-inc.com/blog/easy_excel_interaction_pt5

https://www.paragon-inc.com/blog/easy_excel_interaction_pt6

https://www.paragon-inc.com/blog/easy_excel_interaction_pt7

https://www.paragon-inc.com/blog/easy_excel_interaction_pt8

http://itenium.be/blog/dotnet/create-xlsx-excel-with-epplus-csharp-formulas-and-datavalidation/ (HAY)

https://dzone.com/articles/kubernetes-kafka-event-sourcing-architecture-patte

Reading from an excel cell

var str = sheet.Cells[1, 1].Value;

Decimal.Parse(str, NumberStyles.Float)

Get a cell value from excel using EPPlus and Linq

var sheet = excelPackage.Workbook.Worksheets[sheetname_orSheetIndex];
var objs = from cell in sheet.Cells["a:a"]        // a:a is the column a, Userid
           where cell.Value.ToString().Equals(x)  // x is the input userid
           select sheet.Cells[cell.Start.Row, 2]; // 2 is column b, Email Address

Get all cell value

var cells = worksheet.Cells;
var dictionary = cells.GroupBy(c => new {c.Start.Row, c.Start.Column}).ToDictionary(
                rcg => new KeyValuePair<int, int>(rcg.Key.Row, rcg.Key.Column),
                rcg => cells[rcg.Key.Row, rcg.Key.Column].Value);

foreach (var kvp in dictionary)
    Console.WriteLine("{{ Row: {0}, Column: {1}, Value: \"{2}\" }}", kvp.Key.Key, kvp.Key.Value, kvp.Value);

Finding a value with Epplus

var query = 
    from cell in sheet.Cells["d:d"]
    where cell.Value?.ToString() == ""
    select cell;

Categories

Recent posts