We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Insert Columns an Excel Template using the Python tool

DaisyJones
8 - Asteroid

Hi all,

 

I have a case where I need to insert three new columns in an existing excel template. I believe this is something I could achieve using Python, but my skill set in that area is limited. 

I have made a very basic template where we have a month of data column, then a blank column and finally a total column for that year. It's not accurate as I was trying to make it basic as possible. How would I be able to insert three new columns after the Jan column. Mind that the new columns would have to be after there is a column of data. So if we were to populate the new columns, the next time the tool is run, it would create new columns after the last column of data. 

 

Below are examples of what it looks like for now and how it should look like. 

Screenshot 2022-02-07 155212.png

 Before

Screenshot 2022-02-07 155231.png

After 

 

I hope this makes sense,

 

Thank you

3 REPLIES 3
elhumano
6 - Meteoroid

Hello!

 

This seems doable although I have a few questions:

 

1. Why are you looking to insert empty columns? Would these empty columns be updated with formulas in Excel? Why not insert the empty columns directly in Excel?

2. Are you needing to insert three new columns every time the workflow is run?

3. Can the empty columns have column headers or do they have to be completely empty?

 

Thank you,

Joseph

 

DaisyJones
8 - Asteroid

Hi there,

 

1. Yes they will need to be blank columns and they would be populated using an Alteryx workflow. We want to try an automate a process in one workflow.

2. No, just for when there has been a new input updated

3. They should have headers. This is a report that would be done quarterly so the three new columns are three new months.

 

Thank you, I know this seems like an odd procedure, but it is what has been requested of me. 

 

Thanks again

elhumano
6 - Meteoroid

One option to achieve this is by using a combination of Transpose, Crosstab, Dynamic Rename, and Dynamic Select tools. Please see attached packaged workflow.

Labels
Top Solution Authors