Aug-01-2019, 03:15 PM
Hi,
I use below code to come out a csv file with hyperlinks in each cell. I want to publish this as it is into HTML. Can someone please suggest if there is any fi=unction to do so.
I use below code to come out a csv file with hyperlinks in each cell. I want to publish this as it is into HTML. Can someone please suggest if there is any fi=unction to do so.
import xlsxwriter # %% import pandas as pd input=r'D:\PythonCodes\dashinput.csv' df=pd.read_csv(input) dt=df.iloc[0:0,2] m, n = df.values.shape for i in range(m): for j in range(n): dt=df.values[i,j] print(dt) #%% # Create a new workbook and add a worksheet workbook = xlsxwriter.Workbook('hyperlink.xlsx') worksheet = workbook.add_worksheet('Hyperlinks') # Format the first column worksheet.set_column('A:A', 30) # Add a sample alternative link format. red_format = workbook.add_format({ 'font_color': 'red', 'bold': 1, 'underline': 1, 'font_size': 12, }) # Write some hyperlinks worksheet.write_url('A1', 'http://www.python.org/') # Implicit format. worksheet.write_url('A3', 'http://www.python.org/', string='Python Home') worksheet.write_url('A5', 'http://www.python.org/', tip='Click here') worksheet.write_url('A7', 'http://www.python.org/', red_format) worksheet.write_url('A9', 'mailto:[email protected]', string='Mail me') dsip_item='7/12' # Write a URL that isn't a hyperlink worksheet.write_string('A11', 'http://www.python.org/') worksheet.write_url('A12', r'D:/DataCheck.xlsx',string=dt) workbook.close()