Hi,
I'm trying to create a report of the following format.
Could someone please help me with this
@nkrupabd could you please present more information on the request.
I want to present the data in the specific format only(the format attached above)
@nkrupabd
I have used python tool and xlsxwriter package to render the report in same format.
please find the sample code to above format.
Thank you , But unable to open the workflow can you please send a screen shot, it might be helpful.
Hi @nkrupabd ,
Please find python code.
from ayx import Alteryximport xlsxwriterimport pandas as pddf=Alteryx.read("#1")print(df)workbook = xlsxwriter.Workbook('C:\\Community\\Example3.xlsx')worksheet = workbook.add_worksheet("sheet")#Line 2Line1 = (12345678,'Krupabdhi','havish','SZZ1','1/31/2022','E346222770',42,50.02)row = 1col = 1# Iterate over the data and write it out row by row.for d in (Line1):#worksheet.write(row, col, df[index])worksheet.write(row, col, d,cell_border)col += 1#Line 5cell_format = workbook.add_format({'bold': True,'border': 1})cell_border = workbook.add_format({'border': 1})Line5 = (['Old Rate',42],['Start Date','12/1/2021'],['End Date','12/5/2021'])row = 5col = 3# Iterate over the data and write it out row by row.for header,value in (Line5):#worksheet.write(row, col, df[index])worksheet.write(row, col, header,cell_format)worksheet.write(row+1, col, value,cell_border)#worksheet.write(row+1, col+1, value)col += 1
#line 9
Line9 = (['Date','Wed 01/12'],['Schedule',''],['Pay Code','Sickness Lv'],['Amount',0])row = 9col = 5for header,value in (Line9):#worksheet.write(row, col, df[index])worksheet.write(row, col, header,cell_format)worksheet.write(row+1, col, value,cell_border)#worksheet.write(row+1, col+1, value)col += 1
workbook.close()
Thanks
Thanks a lot .
Hi here the code is generalized to one employee , if we have 10k employees it's not possible to give the details of employees individually.
Please can you suggest if there is any other way.
Thank you
could you please provide sample data and output..
Attaching the example input and output.
For every employee based on the name we need to create the output in the format given and each employee needs to be recorded in a different sheet as in the example Dummy_output.
Below are the input and output
I have updated the python code to read file from input.
Please find the update code below.
from ayx import Alteryximport xlsxwriterimport pandas as pddf=Alteryx.read("#1")workbook = xlsxwriter.Workbook('C:\\Community\\Example3.xlsx')cell_format = workbook.add_format({'bold': True,'border': 1})cell_border = workbook.add_format({'border': 1})for i,rows in df.iterrows():dfLine5=rows[['Old payrate','Date of payrate change','Date of payrate change']].copy()dfLine9=rows[['New payrate','Date of payrate change','Date of payrate change']].copy()i=workbook.add_worksheet(rows[0])row = 1col = 1#Dynamically generate sheets from input datasetfor d in rows:i.write(row, col, d,cell_border)col += 1#Line 5Line5 = ['Old payrate','Date of payrate change','End Date']row = 5col = 3# Iterate over the data and write it out row by row.for header in (Line5):#worksheet.write(row, col, df[index])i.write(row, col, header,cell_format)col += 1rowV = 5colV = 3for j in dfLine5:i.write(rowV+1, colV, j,cell_border)#worksheet.write(row+1, col+1, value)colV += 1# Line 9 Datarow ManipulationLine9 = ['New payrate','Date of payrate change','End Date']L9row = 5L9col = 12# Iterate over the data and write it out row by row.for header in (Line9):#worksheet.write(row, col, df[index])i.write(L9row, L9col, header,cell_format)L9col += 1L9rowV = 5L9colV = 12for j in dfLine9:i.write(L9rowV+1, L9colV, j,cell_border)#worksheet.write(row+1, col+1, value)L9colV += 1workbook.close()
output
Thanks.