I am looking to store some texts into an excel
with multiple work-sheets. I tried to do it using openpyxl
and I am able to achieve it but I am not able to do the same using xlsxwriter
.
I cannot use openpyxl
due to an IllegalCharacterException
popping up when using it. I know ways to remove or escape these characters but I do not want to remove or escape these characters and want to store them as it is in my excel
.
I can achieve the maintainence of characters using xlsxwriter
but not able to store it in multiple worksheets. Is there any solution to this?
You can try something like this.
import pandas as pd
writer = pd.ExcelWriter("my_results.xlsx", engine="xlsxwriter")
for i, element in enumerate(elements):
df = pd.DataFrame(element)
df.to_excel(writer, sheet_name=f"element_{i}")
writer.save()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.