none
Read Excel sheet which was modified only three days before in particular location from c# RRS feed

  • Question

  • I need to Read Excel sheet data in particular location. Those exel files modified or created time should be minimum last three days.

    thanks

    K.Arivu

    • Moved by CoolDadTx Friday, July 24, 2015 3:36 PM Office related
    Friday, July 24, 2015 12:12 PM

Answers

  • You can retrieve the files such as:

    var targetFiles = Directory.GetFiles("YourPathOfFiles") .Where(x => (new FileInfo(x).CreationTime.Date > DateTime.Today.AddDays(-3)

    || new FileInfo(x).LastWriteTime.Date>DateTime.Today.AddDays(-3) ));


    After retrieving list of files, you can read them with excel reader that you use. 

    • Marked as answer by Arivazhagan K Monday, July 27, 2015 7:54 AM
    Friday, July 24, 2015 12:33 PM

All replies

  • You can retrieve the files such as:

    var targetFiles = Directory.GetFiles("YourPathOfFiles") .Where(x => (new FileInfo(x).CreationTime.Date > DateTime.Today.AddDays(-3)

    || new FileInfo(x).LastWriteTime.Date>DateTime.Today.AddDays(-3) ));


    After retrieving list of files, you can read them with excel reader that you use. 

    • Marked as answer by Arivazhagan K Monday, July 27, 2015 7:54 AM
    Friday, July 24, 2015 12:33 PM
  • Actually working with Excel Sheets has two ways:

    If you have .xls and possibly .xlsx to support, you use the (t)rusty Office Interop Com Library, wich requires Office to run on the computer and has all the pitfalls of working with COM.
    Since we always had that, we never developed quite a standalone library for this.

    If you can limit it to .XLSX format only, you can use the OpenXML SDK. Or any ZipArchieve and XMLread classes. The .???x formats are all just a bunch of XML files in a zip compressed contained whose ending was renamed.

    Friday, July 24, 2015 3:23 PM