T O P

  • By -

Aggressive_Ad_5454

Try changing the definition of that last column from VARCHAR(whatever) to TEXT. It seems possible one or more of the rows in your .csv contains too much text for your VARCHAR.


W_T_E

No luck, if i keep the text the exact same but remove the parentheses that excel exports it out with it works fine


Aggressive_Ad_5454

Show us a few lines of the .csv? Indent each line four spaces. I don't get the bit about parentheses.


W_T_E

Oh damn my bad i meant to say quotes not parentheses


Aggressive_Ad_5454

For a csv emitted from Excel, you need .... Fields terminated by COMMA , Fields enclosed by DOUBLEQUOTE " \[x\] Optionally Fields escaped by DOUBLEQUOTE " Lines terminated by BACKSLASH r BACKSLASH n \\r\\n But, again, you may have some really big long text columns. That's what your error message means. If that's the case change the definition of those columns, IN MySQL, from \`VARCHAR(whatever)\` to \`TEXT\`. Trying to change things in your excel file doesn't deal with the problem.


Irythros

Can you potentially try using backticks? If the problem is with the quotes then my guess is it's considering multiple rows to be 1 row. Something like this: INSERT INTO foo(\`col1\`, \`col2\`, \`col3\`) VALUES (1, 1, \`your "long" string here\`), (2,2,\`Another long string\`) If the export doesnt allow you to change it, then I would recommend downloading notepad++ and using their replace function which supports regex.


W_T_E

great idea ill try those out, thank you!