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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
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( 'A9' , 'mailto:jmcnamara@cpan.org' , string = 'Mail me' ) dsip_item = '7/12' # Write a URL that isn't a hyperlink worksheet.write_url( 'A12' , r 'D:/DataCheck.xlsx' ,string = dt) workbook.close() |