How to Automate Separate Tables from a CSV File

-1

I have several files that have this type of "problem" (exemplified below), in which a file has more than one table with different structures. I'm using an XML file to read these tables, but I wonder if you do not have an automated way of doing this, using some artificial intelligence technique or something like

nomeTabela01

'login'  'plain'    'IP'     
 ------------------------
 dadosx   dadosx     ip1         
 dados1   dados2     ip1         
 dados1   dados2     ip2            
 dados1   dados2     ip3        
 dados1   dados2     ip4    
 dados1   dados2     ip1      
 dados1   dados2     ip4    
 dados1   dados2     ip9    
 dados1   dados2     ip7

 nomeTabela02

           '2018' '2017' '2016'
 'Linha1'    x      x      d
 'Linha2'    d      s      y
 'Linha3'    k      a      r
 'Linha4'    s      z      a

 nomeTabela03

           '2018' '2017' '2016'
 'Linha1'    f      f      d
 'Linha2'    a      h      y
 'Linha3'    k      a      f
 'Linha4'    p      l      a

------------------------ Example of how I'm doing now with XML --------------- -------

 <CSV id='2' tipo_planilha='3'>
       <nome_arquivo> Arquivo01 </nome_arquivo>
        <tabela> tabelaBD </tabela>
          <colunas> 
             <coluna id='1'> login</coluna>
             <coluna id='2'> plain </coluna>
             <coluna id='3'> IP </coluna>
          </colunas>
 </CSV>


 <CSV id='1' tipo_planilha=’1’>
    <nome_arquivo> Arquivo01 </nome_arquivo>
     <tabela> tabelaBD01 </tabela>
        <titulos>
            <titulo id=’1’>nomeTabela02</titulo>
             <titulo id=’3’>nomeTabela03</titulo>
         </titulos>
</CSV>

Even this part is working very well, but it is a laborious exercise if you count that there are several files with different forms of tables, I would like a light on which way I could go to make this more autonomous reading (these data will be inserted in a BD)

    
asked by anonymous 21.12.2018 / 12:52

0 answers