pawelsalawa / sqlitestudio

A free, open source, multi-platform SQLite database manager.
https://sqlitestudio.pl
Other
4.67k stars 571 forks source link

CsvImport.FirstRowAsColumns not working #5001

Closed cmedinga closed 5 months ago

cmedinga commented 5 months ago

Details

When importing a file using SELECT import, the option CSvImport.FirstRowAsColumns=false is not working. I have a csv with duplicated column names, and want to import it, skipping the first line, so I run the query in the section below. The result is an error telling me that "Could not create the table to import to: duplicate column name: xxxxxx"

Steps to reproduce

Create a csv file with repeated column names, using ; as separator. Run :

SELECT import('C:/myfilecsv', 'CSV', 'test_table', 'latin1', 'CsvImport.FirstRowAsColumns=false 
CsvImport.Separator=4 
CsvImport.CustomSeparator=; 
CsvImport.NullValues=true');

Error: "Could not create the table to import to: duplicate column name: xxxxxx"

Operating system

Windows 10

SQLiteStudio version

3.4.4

cmedinga commented 5 months ago

It worked fine using this instead:

SELECT import('C:/myfilecsv', 'CSV', 'prueba', 'latin1', 'CsvImport.FirstRowAsColumns=false
CsvImport.Separator=1
CsvImport.NullValues=true
CsvImport.QuotationMark="
');

It seems the custom separator was not working well. I also guessed the QuitationMark parameter, which is not in the docs, but it turns out it works fine with quoted texts containing line breaks.