Filter Rows of Imported Spreadsheet

3 posts, 1 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Sep 2013

    Posted 16 Sep 2015 Link to this post

    We currently have a web application that allows the user to upload (utilizing the RadAsyncUpload control) files of different formats (csv,html,txt,xlsx) where the file stream (using the IWorkBookFormatProvider) is ultimately converted to a PDF and stored in a MSSQL database record.  The purpose of this process is so that we can have varying formats of input data and a common datatype that can be displayed in the web application.  The problem is that some of the csv, txt and xlsx files can have as many as 750,000 rows of data and for the purpose being discussed, we are only interested in the first 50 rows of the file.  I can use RowSelection and Remove the unwanted rows on smaller files.  However, this takes a long time to accomplished on large files.  How can I:

    1. Filter the worksheet rows so that I only get the first 50, or
    2. Insert the first 50 rows from worksheet A to worksheet B.

    Thanks,

     Michael

  2. Answer
    Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 21 Sep 2015 Link to this post

    Hi Michael,

    Currently, there is no way to import only part of the document.

    The only thing I could offer you is applicable for CSV and TXT files only. These two file types contains values separated by new lines, each line contains the values from one row of the worksheet. If it works for you, you can preprocess the TXT and CSV files so you get only the first 50 lines of them, create new file and import it using RadSpreadProcessing.

    Handling XLSX file format is more complicated. The XLSX file is ZIP archive which contains XML files. The worksheets are separate files in the archive. You could get them and try to preprocess them, so you take the first 50 rows, which are defined using the <row> tag and skip the rest rows and create new XML document with reduced number of rows you can import it using RadSpreadProcessing. I am not sure if this processing of the XML files will be much faster than importing the document. But it will spare the time needed to store the cell values in the data structures of the processing library.

    Regards,
    Nikolay Demirev
    Telerik
  3. Michael
    Michael avatar
    3 posts
    Member since:
    Sep 2013

    Posted 21 Sep 2015 in reply to Nikolay Demirev Link to this post

    Hey Nicolay,

     Thanks for getting back to me and I will give your suggestion a shot.

    Regards,

    Michael

Back to Top