Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to bold csv data in excel?

Tags:

python

I work on a python(django) project. I write csv code as follows,

response = HttpResponse(mimetype='text/csv')    
response['Content-Disposition'] = 'attachment; filename=DueDateWiseSearch.csv'    
writer =  csv.writer(response)    
writer.writerow(['Infant Name','Mother Name','Mother Address',
     'Next Vaccine Dose','Due date','Coments'])

this row is the header and I need to bold all header text. I download csv as ms "Excel" file.

How can I do it? Please help!

like image 712
Jakir Hosen Khan Avatar asked Sep 20 '10 06:09

Jakir Hosen Khan


People also ask

How do you make text bold in CSV?

There's no way to do that in CSV. You could all caps the output, or you could use another format that supports text styles. Show activity on this post. CSV only contains data, it doesn't contain any formatting information.

Can you add formatting to a CSV file?

There is no way to add formatting to CSV file. It can only ever be text.


2 Answers

CSV only contains data, it doesn't contain any formatting information. If you need to format your data, I'd suggest actually creating an XLS file instead of a CSV file. Try using something like xlwt.

like image 154
Tauren Avatar answered Sep 21 '22 17:09

Tauren


There's no way to do that in CSV. You could all caps the output, or you could use another format that supports text styles.

like image 24
SingleNegationElimination Avatar answered Sep 22 '22 17:09

SingleNegationElimination