Click here to Skip to main content
15,915,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am successfully get data from Excel sheet usig LinqToExcel But I want to save date to Excel with LinqToExcel.

What I have tried:

public  void ExcelWrite()
       {
       	 string pathToExcelFile = ""
    + @"C:\\Users\\Admin\\Desktop\\Excl.xlsx";
 
    string sheetName = "Sheet1";
 
    var excelFile = new ExcelQueryFactory(pathToExcelFile);
 
    // ADD COLUMN MAPPINGS:
    excelFile.AddMapping("Name", "Artist Name");
    excelFile.AddMapping("Title", "Album Title");

    var artistAlbums = from a in excelFile.Worksheet<PropertyClass>(sheetName) select a;

    foreach (var a in artistAlbums)
    {
        string artistInfo = "Artist Name: {4}; Album: {5}";
        Console.WriteLine(artistInfo, a.Name, a.Title);
    }
       }
Posted
Updated 30-Mar-17 4:25am

1 solution

According to the introduction[^], that project is designed to:
Retrieve data from spreadsheets and csv files by using LINQ

There is nothing to indicate that this library can be used to modify a spreadsheet.

To do that, you'll need to use a library that supports it. For example:
 
Share this answer
 
Comments
Kats2512 31-Mar-17 2:28am    
Very good links, I think EPPLUS is an excellent answer to this question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900