I have CSV file (text file with TAB delimiters). It's a XER file used by Primavera P6 Professional v8 for import/export data.
First task: How to load XER file into Workbook?
Mostly XER file size is not big: 0.5 – 3.3 MB (5200 – 17000 rows). Maximum filesize (seldom) is 20 MB (160 000 rows).
And I think it's have sense to load whole file in memory and then parse it.
How to do it?
Next task is Parsing
1. XER file is a text file with TAB delimited columns.
2. XER file consist from block of date. Each block have 3 parts:
First line (started from "%T") of block is Table header. Second line ("%F") is Fields headers. And next rows contain data ("%R").
%T RCATVAL%F rsrc_catg_id rsrc_catg_type_id seq_num rsrc_catg_short_name rsrc_catg_name parent_rsrc_catg_id%R 56 22 0 Yes Yes %R 27968 22 0 Yes Yes %R 28020 27776 10 Yes Description%T NEXT_TABLE%F new fields set%R A B C
3. Each table have regular structure.
4. Fields sets in each table (text block) are different.
5. Values of data are variant (but stored in XER file as text)
6. XER file not contain blank rows or special data blocks separator.
7. Last row of XER file is "%E".
My plane is:
A. Parse XER file in memory row by row.
B. When new table ("%T") appears create new Sheet.
C. Then write fields headers ("%F") and rows ("%R")
1. What is more efficient method for split row (by TAB) to cells (when you don't know columns count, at least for first row "%F" of table)?
2. Maybe if we deal with large data files (160 000 rows) have sence to load whole file (20 MB) into memory, split to tables (block of data) via RegExp and then parse block to rows (or somehow paste them into sheets as array).
3. How to determine total rows count for showing form with progress bar?
4. How to determine Excel version for setup rows limit? --> Global Const EXCEL_ROW_LIMIT = 65536 (or 1048576)
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
-Mike Kapnisakis, Warner Bros
With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. You'll also be able to connect with highly specified Experts to get personalized solutions to your troubleshooting & research questions. It’s like crowd-sourced consulting.
We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Our certified Experts are CTOs, CISOs, and Technical Architects who answer questions, write articles, and produce videos on Experts Exchange. 99% of them have full time tech jobs - they volunteer their time to help other people in the technology industry learn and succeed.
We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.