How to save in *.xlsx long URL in cell using Pandas

You can create an ExcelWriter object with the option not to convert strings to urls:

writer = pandas.ExcelWriter(
    r'file.xlsx', 
    engine="xlsxwriter",
    options={'strings_to_urls': False}
)
df.to_excel(writer)
writer.close()

In more recent versions of Pandas, you need to write

writer = pd.ExcelWriter(
   r'file.xlsx', 
   engine="xlsxwriter",
   engine_kwargs={'options': {'strings_to_urls': False}}
 )

Leave a Comment