[英]Add Hyperlink to Excel csv file in python
Hello i am making a software which gets data from an API and puts it in excel in csv format using pandas.您好,我正在制作一个软件,该软件从 API 获取数据并使用 Pandas 将其以 csv 格式放入 excel 中。
df2 = pd.DataFrame(data, columns=["Certificate #", "Lab", "Shape", "Size", "Color", "Clarity", "Min", "Max", "Hgt", "Cut", "Depth", "Table", "Pol", "Sym", "Flour", "Key to Symbols", "Comments", "Type", "Rep. Date", "Stock #", "$/ct", "Rap", "Company"])
df2.to_csv(os.path.join(os.getcwd(), "OUTPUTS", "GiaOut_" + strftime("%d-%m-%Y") + "_" + sys.argv[1]))
data is a list of lists where each item is a string. data 是一个列表列表,其中每个项目都是一个字符串。 i want the second column "Lab" to be a hyperlink.
我希望第二列“实验室”是一个超链接。 it should display the text " LAB " underlined in blue and a link behind it.
它应该显示带有蓝色下划线的文本“ LAB ”及其后面的链接。
thanks谢谢
df.to_excel
, all your formatting will not be gonna save.df.to_excel
保存它,则您的所有格式都不会保存。 Instead of this, you have to create/open an excel spreadsheet through ExcelWriter
and have to save according to this code snippet.ExcelWriter
创建/打开一个 excel 电子表格,并且必须根据此代码片段进行保存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.