Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

create a report

nkrupabd
Asteroide

Hi,

I'm trying to create a report of the following format. 

Could someone please help me with this

11 RESPUESTAS 11
nkrupabd
Asteroide

Below are the input and output

saveeshkumar
Cometa

Hi @nkrupabd ,

 

I have updated the python code to read file from input.

 

Please find the update code below.

 

from ayx import Alteryx
import xlsxwriter
import pandas as pd
df=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 = 1
col = 1
#Dynamically generate sheets from input dataset
for d in rows:
i.write(row, col, d,cell_border)
col += 1
#Line 5
Line5 = ['Old payrate','Date of payrate change','End Date']
row = 5
col = 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 += 1
rowV = 5
colV = 3
for j in dfLine5:
i.write(rowV+1, colV, j,cell_border)#worksheet.write(row+1, col+1, value)
colV += 1
# Line 9 Datarow Manipulation
Line9 = ['New payrate','Date of payrate change','End Date']
L9row = 5
L9col = 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 += 1
L9rowV = 5
L9colV = 12
for j in dfLine9:
i.write(L9rowV+1, L9colV, j,cell_border)#worksheet.write(row+1, col+1, value)
L9colV += 1

workbook.close()

 

saveeshkumar_0-1643886628946.png

 

output

 

saveeshkumar_1-1643886660521.png

 

Thanks.

 

Etiquetas