Neo4j: Import csv - quote error, but no quotes in file - csv

I would like to import a csv-file into neo4j. This file was created by myself using the Mac textedit.app. The options in my textedit.app are set in such a way that there is "no css".
When I try to import the file neo4j says:
At [URL] # position 16471 - there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what I read: 'stylesheet"='
The problem is, there is no such line in the file. What's wrong?

Finally I solved the issue: the URL was a dropbox-URL, and instead of ?dl=0 one must state the option ?raw=1

Related

Invalid literal because symbol appears when reading a csv file

When I am using replit I can remove the little symbol that appears when I drag and drop in a csv file so my main.py can read it, otherwise I get invalid literal base 10 issue. I am trying to run this on local machine with sublime text and getting same error now as it is reading the file from the directory, so I assume it is adding this symbol in before reading.... I can click on the csv file in replit and edit, but cannot do this in sublime.
Can someone explain what this is for? HOw can I get it to read the basic comma delimited numbers in the file (It is a game tile map).
with open(f'level{level}_data.csv', newline= '') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
Saved it is comma delimited csv instead of UTF-8 comma delimited csv. It then imports without the 'question mark in a diamon' symbol. I understand this is an unrecognised special character, but I have nothing apart from integers in my table. Maybe someone could clarify that?...

How to import csv in KNIME and ignore the quote marks

I have a csv file with data like this:
"Column1; Column2; Column3"
"ValueA; ValueB; ValueC"
"ValueD; ValueE; ValueF"
When i import it using the 'CSV Reader'-Node it interprets the quote marks as content.
I need the data to be imported without the quotation marks though (formatting it after that does not feel like a clean way of doing this and the node interprets the data formats wrong).
The setting of the node is as follows: https://i.stack.imgur.com/FJC1k.png
How can i deal with this?
In configuration dialog add " as Quote Char.
#FlipForties Hi,
As a heavy KNIME user I would recommend trying to load your data via the File Reader node instead. It's much more flexible than the CSV Read node and you should be able to load your data as is without issues. I made a test data-set and it looks ok upon load. See screen shot below:
enter image description here

Import huge data from CSV into Neo4j

When I try to import huge data into neo4j it gives following error:
there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what I read: 'Hello! I am trying to combine 2 variables to one variable. The variables are Public Folder Names and the ParentPath. Both can be found using Get-PublicFolder
Basically I want an array of Public Folders Path and Name so I will have an array like /Engineering/NewUsers
Below is my code
$parentpath = Get-PublicFolder -ResultSize Unlimited -Identity """ "'
It seems that there may be some information lacking from your question, especially about the data that is getting parsed, stack trace a.s.o.
Anyway, I think you can get around this by changing which character is treated as quote character. How are you calling the import tool and which version of Neo4j are you doing this on?
Try including argument --quote %, and I'm making this up by just using another character % as quote character. Would that help you?

Can't import csv to neo4j

My code:
LOAD CSV FROM "C:\Users\Elmar\Desktop\tmp-raise.csv" AS line
WITH line
RETURN line
The error that it gives:
Invalid input ':': expected 'o/O' (line 1, column 18 (offset: 17))
"LOAD CSV FROM "C:\Users\Elmar\Desktop\tmp-raise.csv" AS line"
^
I have also tried:
USING PERIODIC COMMIT 10000
LOAD CSV FROM ""C:\Users\Elmar\Desktop\tmp-raise.csv" AS line
WITH line
RETURN line
What is the problem? Can anyone help me?
According to the CSV import guide, your path should be prefixed with file: and should use forward slashes. The example path given in the guide for windows is file:c:/path/to/data.csv (though I have seen example paths starting with file://). Give this a try:
USING PERIODIC COMMIT 10000
LOAD CSV FROM 'file:c:/Users/Elmar/Desktop/tmp-raise.csv' AS line
WITH line
RETURN line
If that doesn't work, give it a try with file:// as the path prefix.
EDIT: Looks like CSV loads use a relative path from the default.graphdb/import folder. I had thought that was for Mac/Unix only, but it looks like Windows does the same. If you move CSVs you want to import into the import folder, you should be able to load them using file:///theFileName.csv
Load csv from "file:///C:/xyz.csv" as line
return line
The above code works well. But do comment out the configuration
dbms.directories.import=import
in the settings.
Other solution is you can drop a (.txt, .cyp, .cql) file in the drag to import box.

PHP: creating CSV file with windows encoding

i am creating csv files with php. To write the data into my csv file, i use the php function "fputcsv".
this is the issue:
i can open the created file normally with Excel. But i cant import the file into a shopsystem (in this case "shopware"). It says something like "the data could not be read".
And now comes the clue:
If i open the created file and choose "save as" and select "CSV (comma delimited)" in type, this file can be imported into shopware. I read something about the php function "mb_convert_encoding" which i used to encode the data, but it could not fix the problem.
I will be very glad if you can help me.
thanks.
Thanks for your input.
I solved this problem by replacing fputcsv with fwrite. Then i just needed to add "\r\n" (thanks wmil) to the end of the line and the generated file can be read by shopware.
Obviously the fputcsv function uses \n and not \r\n as EOL character.
I think you cannot set the encode using fputcsv. However fputcsv looks to the locale setting, wich you can change with setlocale.
Maybe you could send your file directly to the users browser and use changing contenttype and charset with header function.
This can't be answered without knowing more about your system. Most likely it has nothing to do with character encoding. It's probably a problem with wrong number of columns or column headers being incorrect.
If it is a character encoding issue, your best bet is:
$new_str = mb_convert_encoding($str, 'Windows-1252', 'auto');
Also end newlines with \r\n, not just \n.
If that doesn't work you'll need to check the software docs.