cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arpost
Super User
Super User

Is it possible to get a specific column from a CSV?

I need to create a flow that can process a CSV file and extract a specific column, ignoring the rest of the columns. The CSV to be processed can vary dramatically, so I need a solution that gets the header of the CSV and then only returns the column required.


For example, I could have a CSV like the following:

 

ColumnA|ColumnB|ColumnC

1|2|3

4|5|6

My flow needs to process the CSV and extract just, say, ColumnB and it’s data, so the final product would be:

 

ColumnB

2

5

 

Another file, however, could be configured as follows:

 

Col1|Col2|Col3|Col4

A|B|C|D

E|F|G|H

 

In this example, I might want Col3, so the final output would be:

 

Col3

C

G

 

Anyone have any clever ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @arpost,

Do you want to fetch a special column a csv file?

Could you please share a bit more about your scenario?

 

I create a csv file and get the column name from it.

vqiaqimsft_0-1643338526484.pngvqiaqimsft_1-1643338641993.png

 

split(string(first(variables('List'))),'",')
split(replace(replace(replace(item(), '"', ''), '}', ''), '{', ''), ':')[0]

 

Then you could check the link as below to fetch a dynamic column:

excel - How to fetch specific column data from xls in microsoft flow - Stack Overflow

Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

Hi @arpost,

Do you want to fetch a special column a csv file?

Could you please share a bit more about your scenario?

 

I create a csv file and get the column name from it.

vqiaqimsft_0-1643338526484.pngvqiaqimsft_1-1643338641993.png

 

split(string(first(variables('List'))),'",')
split(replace(replace(replace(item(), '"', ''), '}', ''), '{', ''), ':')[0]

 

Then you could check the link as below to fetch a dynamic column:

excel - How to fetch specific column data from xls in microsoft flow - Stack Overflow

Best Regards,
Qi

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,004)