Export Pandas data frame with text column containg utf-8 text and URLs to Excel <p>My Pandas data frame consists of Tweets and meta data of each tweet (300.000 rows). Some of my colleagues need to work with this data in Excel which is why I need to export it.</p> <p>I wanted to use either <code>.to_csv</code> or <code>.to_excel</code> which are both provided by Pandas but I can't get it to work properly.</p> <p>When I use <code>.to_csv</code> my problem is that it keeps failing in the text part of the data frame. I've played around with different separators but the file is never 100% aligned. The text column seems to contain tabs, pipe characters etc. which confuses Excel.</p> <pre><code>df.to_csv('test.csv', sep='\t', encoding='utf-8') </code></pre> <p>When I try to use <code>.to_excel</code> together with the <code>xlsxwriter</code> engine I'm confronted with a different problem, which is that my text column contains to many URLs (I think). <code>xlswriter</code> tries to make special clickable links of these URLs instead of just handling them as strings. I've found some information on how to circumvent this but, again, I can't get it to work.</p> <p>The following bit of code should be used to disable the function that I think is causing trouble:</p> <pre><code>workbook = xlsxwriter.Workbook(filename, {'strings_to_urls': False}) </code></pre> <p>However, when using <code>to_excel</code> I can't seem to adjust this setting of the Workbook object before I load the data frame into the Excel file.</p> <p>In short how do I export a column with wildly varying text from a Pandas data frame to something that Excel understands?</p> <p><strong>edit:</strong> example:</p> <pre><code>@geertwilderspvv @telegraaf ach Wilders toch, nep-voorzitter van een nep-partij met maar één lid, \nzeur niet over nep-premier of parlement! </code></pre> <p>So in this case It is obviously a line brake that is my data. I will try to find some more examples.</p> <p><strong>edit2:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"&gt;&lt;logFileName&gt;error047600_01.xml&lt;/logFileName&gt;&lt;summary&gt;Er zijn fouten aangetroffen in bestand C:\Users\Guy Mahieu\Desktop\Vu ipython notebook\pandas_simple.xlsx&lt;/summary&gt;&lt;removedRecords summary="Hier volgt een lijst van verwijderde records:"&gt;&lt;removedRecord&gt;Verwijderde records: Formule van het onderdeel /xl/worksheets/sheet1.xml&lt;/removedRecord&gt;&lt;/removedRecords&gt;&lt;/recoveryLog&gt; </code></pre> <p>Translation of Dutch stuff:</p> <p>Errors were found in "file". Here follows a list of removed records: removed records: formula of the part /xl/worksheets/sheet1.xml</p>