how add link to excel file using python
Question: I'm generating an csv file that is opened by excel and converted to xlsx
manually. The csv contains some path to .txt files. Is it possible to build
the file path in such way that when the csv is converted to xlsx , they became
clickable hyperlinks ?

Thanks.


Answer: I would be interested to understand your workflow a bit better, but to try and
help with your specific request:

  * The HYPERLINK solution proposed in the comments looks like a good one
  * If you are able to implement that upstream in the csv generation step then great
  * If not and/or you are interested in automating the conversion process, consider using the pandas library: 
    * Create a DataFrame object from a csv using the [pandas.read_csv](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html) method
    * Convert your paths to HYPERLINKs
    * Write back to xlsx using the [pandas.DataFrame.to_excel](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_excel.html) method 

E.g. if you have a file original.csv and the relevant column header is
file_paths:

    
    
    import pandas as pd
    
    
    df = pd.read_csv('original.csv')
    df['file_paths'] = '=HYPERLINK("' + df['file_paths'] + '")'
    df.to_excel('new.xlsx', index=False)
    

Hope that helps!

Jon

