Feature #2606
closedHandling unnecessary white spaces in CSV imports
Description
Update
It turned out to be a white-space problem with imports. We used this opportunity to handle these cases automatically (removing the unneeded white-spaces) to make imports less error prone.
Original text
I'm very sorry Bernhard. I have to import 600 biblio items from zotero and I have prepared a very basic CSV and only I get 'Error at import' and I'm not able to find where the fault is (openatlas version 8.13 > ... Import Bibliography). Very grateful for your help.
id,name,description,type_ids RieraMelisA-2015,"RieraMelisA-2015 Mercat i regulació: inspecció","Antoni Riera i Melis, /Mercat i regulació: inspecció, controls de qualitat i defensa dels consumidors als mercats medievals ibèrics/, in El Mercat de Balaguer: una cruïlla, ed. by Flocel Sabaté, Ajuntament de Balaguer (Balaguer, 2015), pp. 63-79",2 RieraMelisA-1980,"RieraMelisA-1980 La Lezda de Colliure bajo la administración mallorquina","Antoni Riera i Melis, /La Lezda de Colliure bajo la administración mallorquina. I: La reforma de aranceles de finales del siglo XIII (1299?)/, Acta historica et archaeologica mediaevalia, no. 1 (1980), pp. 91-126",3 RieraMelisA-2021,"RieraMelisA-2021 Alimentación, Sociedad, Cultura y Política", "Antoni Riera i Melis, Alimentación, Sociedad, Cultura y Política En El Occidente Medieval, Primera edición (Ediciones Trea, 2021)",4where type_ids in my DB (from initdb) are:
- 2 >> Inbook
- 3 >> Article
- 4 >> Book
Files
Updated by Enric Rodellas 4 months ago
- Status changed from New to Closed
Aggggghhhhhhhhhhhhhhh!!
It was a space in third record between second and third field.
ura y Política", "Antoni Riera
Updated by Alexander Watzinger 4 months ago
- Tracker changed from Feature to Question
- Category set to Data import/export
No worries Enric and glad you found the culprit.
I'm not sure about the details here but I added Bernhard as watcher in case this type of mistake can somehow be caught and dealt with at the import side.
Updated by Bernhard Koschiček-Krombholz 4 months ago
- Tracker changed from Question to Feature
- Assignee set to Bernhard Koschiček-Krombholz
- Target version set to 8.15.0
I can add skipinitialspace=True to the pd.csv_read() function. This solves this problem.
Updated by Alexander Watzinger 4 months ago
- Subject changed from Bibliography import by CSV to Handling unnecessary white spaces in CSV imports
- Description updated (diff)
Updated by Alexander Watzinger 4 months ago
- Target version changed from 8.15.0 to 8.14.0