Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
Sending out a csv attachment with Django Email, is forcing the COLUMN_HEADERS into the next row if they are over 998 characters long

Steps to reproduce:

1) Get a LONG line of comma separated values (mine starts balking at 998 characters).

2) Send that out through Django Email: message.attach('some.csv', csv_file, 'text/csv')

3) Open file in email, and notice that your values have been written to the second row, instead of staying all on one row.

Input/Output

Input:

csv_file = 'FIELD_1,FIELD_2,FIELD_3,...,FIELD_998, FIELD_999'

Expected Output (all on one row):

FIELD_1 | FIELD_2 | FIELD_3 | ... | FIELD_998 | FIELD_999

Actual Output:

FIELD_1 | FIELD_2 | FIELD_3 | ... | FIELD_ 998 | FIELD_999

(Please note this is an example, it starts to balk at 998 char's not specifically strings)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is happening through the django email attachment being sent as a text/csv and the limitations of that. It's almost acting like a 'word wrap'. Changing text/csv to application/octet-stream, leaves the data as-is. https://docs.djangoproject.com/en/1.11/topics/email/#emailmessage-objects

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!