Adding a newline character within a cell (CSV)

This question was answered well at Can you encode CR/LF in into CSV files?. Consider also reverse engineering multiple lines in Excel. To embed a newline in an Excel cell, press Alt+Enter. Then save the file as a .csv. You’ll see that the double-quotes start on one line and each new line in the file … Read more

importing a CSV into phpmyadmin

In phpMyAdmin, click the table, and then click the Import tab at the top of the page. Browse and open the csv file. Leave the charset as-is. Uncheck partial import unless you have a HUGE dataset (or slow server). The format should already have selected “CSV” after selecting your file, if not then select it … Read more

_csv.Error: field larger than field limit (131072)

The csv file might contain very huge fields, therefore increase the field_size_limit: sys.maxsize works for Python 2.x and 3.x. sys.maxint would only work with Python 2.x (SO: what-is-sys-maxint-in-python-3) Update As Geoff pointed out, the code above might result in the following error: OverflowError: Python int too large to convert to C long. To circumvent this, … Read more

How can I output MySQL query results in CSV format?

From Save MySQL query results into a text or CSV file: Note: That syntax may need to be reordered to in more recent versions of MySQL. Using this command, columns names will not be exported. Also note that /var/lib/mysql-files/orders.csv will be on the server that is running MySQL. The user that the MySQL process is running under must have permissions … Read more

PHP to write Tab Characters inside a file?

The tab character is \t. Notice the use of ” instead of ‘. PHP Strings – Double quoted If the string is enclosed in double-quotes (“), PHP will interpret more escape sequences for special characters: … \t horizontal tab (HT or 0x09 (9) in ASCII) Also, let me recommend the fputcsv() function which is for the purpose of writing CSV files.

How to parse tsv file with python?

Just use the csv module. It knows about all the possible corner cases in CSV files like new lines in quoted fields. And it can delimit on tabs. will correctly output:

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)