add hyperlink to excel sheet created by pandas dataframe to_excel method

后端 未结 5 1584
栀梦
栀梦 2020-12-15 11:56

I have converted a pandas DataFrame to an Excel sheet using df.to_excel.

Now, I want to add hyperlinks to the values in one column. In other words, when a customer

5条回答
  •  一向
    一向 (楼主)
    2020-12-15 12:17

    You could use the HYPERLINK function

    import pandas as pd
    df = pd.DataFrame({'link':['=HYPERLINK("http://www.someurl.com", "some website")']})
    df.to_excel('test.xlsx')
    

提交回复
热议问题