cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Write Variable in dynamic column

Hi community,

 

I want to write the variables "First name" and "Last name" into an Excel file. I want Power Automate Desktop to find out for itself in which column the "First name" should be written, depending on the column header in the target file. So that the column is dynamic and the variable is written in, for example, column 1 or whatever.

Has anyone experience in a similar case ? Or even a solution?

example screenshotexample screenshotexcelexcel

1 ACCEPTED SOLUTION

Accepted Solutions
fraenK
Memorable Member
Memorable Member

To make it "dynamic", you'll need to read the Excel file first to get the headers and their column numbers.

"Write to Excel worksheet" only works with column number or letter.

Cloud flows handles Excel files much better.

View solution in original post

2 REPLIES 2
fraenK
Memorable Member
Memorable Member

To make it "dynamic", you'll need to read the Excel file first to get the headers and their column numbers.

"Write to Excel worksheet" only works with column number or letter.

Cloud flows handles Excel files much better.

Ashleypettit1
Frequent Visitor

It is suprisingly complicated to do this in PAD. Write to %Row[%N%]% is not allowed and hence a workaround is required. 

 

Here my end goal is to write '' into the Column with the header of Done? into any row where the value contains "ERROR"

 

The solution in short creates a variable %N% which is the Column Number that contains the header of "Done?". 

 

The workaround I found that works is shown below1.png2.png

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,454)