By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,245 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,245 IT Pros & Developers. It's quick & easy.

Add blank rows to a CSV file

P: 5
I have a program that goes to a MySQL table and puts all the data of the table in a CSV file, now I want to leave 6 rows in blank at top of the file when open in Excel, but I dont know how to do that.


I use these to put all the data to into the csv file

Expand|Select|Wrap|Line Numbers
  1. my $sql = "SELECT * INTO OUTFILE 'c:/proyecto/$filename'
  2. FIELDS TERMINATED BY ','
  3. LINES TERMINATED BY '\r\n' FROM t3132";
can someone help me with these problem?

Thank you
Jan 9 '08 #1
Share this Question
Share on Google+
2 Replies


KevinADC
Expert 2.5K+
P: 4,059
I have a program that goes to a MySQL table and puts all the data of the table in a CSV file, now I want to leave 6 rows in blank at top of the file when open in Excel, but I dont know how to do that.


I use these to put all the data to into the csv file

Expand|Select|Wrap|Line Numbers
  1. my $sql = "SELECT * INTO OUTFILE 'c:/proyecto/$filename'
  2. FIELDS TERMINATED BY ','
  3. LINES TERMINATED BY '\r\n' FROM t3132";
can someone help me with these problem?

Thank you
Where is your code that produces the CSV output and writes it to a excel file? That is where you would insert a blank line.
Jan 9 '08 #2

P: 33
As Kevin said..
use the following statement at the place where you have to leave empty rows.

print "\n" x 6; # as you mentioned 6 empty rows are needed.
Jan 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.