I have an Excel file (Available at Google Drive) with data which was saved with a very strange format in order to get printed easily:
And every table repeats daily for over 5 years. I need to analyze this data and tried to get a relational format in order to load it in R/Python-like tools and get only 5 columns:
| DATE | CLIENT NAME | TEST | MEASUREMENT | TESTER |
|---|---|---|---|---|
| 01-01-2023 | JOHN SMITH | METABOLYTE A | 0.01 | PhD. IMA GU |
| 01-01-2023 | JOHN SMITH | METABOLYTE B | 10 | PhD. IMA GU |
| 01-01-2023 | JOHN SMITH | PCR | NEGATIVE | PhD. IMA GU |
| 01-01-2023 | JOHN SMITH | MUTATION | +++ | PhD. IMA GU |
| 01-01-2023 | ALBUS DUMBLE | PREGNANT | NEGATIVE | TECH. GUIVER |
| 01-01-2023 | ALBUS DUMBLE | GLUCOSE | 121 | TECH. GUIVER |
| 02-01-2023 | MAYDAY JUNE | METABOLYTE A | 0.01 | PhD. IMA GU |
| 02-01-2023 | JOHN SMITH | METABOLYTE A | 0.01 | TECH. GUIVER |
| 02-01-2023 | JOHN SMITH | METABOLYTE B | 10 | TECH. GUIVER |
| 02-01-2023 | JOHN SMITH | PCR | NEGATIVE | TECH. GUIVER |
| 02-01-2023 | JOHN SMITH | MUTATION | +++ | TECH. GUIVER |
So, in order to get a conversion from non-relational data to relational table I have applied text-mining techniques available at this GitHub repo. But, basically, have converted everything into one column with tidyr::pivot_longer(). Is there any optimal function or method to detect and tabulate this kind of data, or should i try to do it with a loop (+843 files)?

My attempt is based on fact, that the entries are formatted identically, so we can use kind of 'moving window'.
Now we have to define data frame for data storage. Comments like
# [2,2] +0, +1corresponds to row and column ofa(loaded excel).Now we have to find all rows with
NOMBREand use it in loop like:
And finally the data:
Created on 2023-06-18 with reprex v2.0.2
You should extend the
entrydata frame to grab all variables from your data. And then loop it through all excels you have.