Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Flo_19
Frequent Visitor

Select all columns in a table

Hello everybody,

 

I'm currently searching to change the source of one table in the Advance Editor. 

 

My file 1 has the following source : 

Source = Csv.Document(File.Contents(\\dataview.fr\View\current_year\argos.csv),[Delimiter=";", Columns=37, Encoding=1252, QuoteStyle=QuoteStyle.None])

I want my second file (let's call it file 2) to source from file 1 : 

Source = Table.SelectColumns(#"file 1",{"Spec", "SI", "Serv", "Action", "Libel", "Date", ...})

 

There are a lot of columns in my file 1, do you know a faster and safer way to select all the columns in my file 1 ? Thank you !

 

 

2 ACCEPTED SOLUTIONS
m_dekorte
Super User
Super User

Hi @Flo_19,

 

You can create a reference to file 1, that will always get you the final result from the File 1 query

The code will look like this: Source = #"file 1"

 

The easiest way to create a reference to another query is to right click the query you want to reference and select reference in the option list. Know that any future changes to File 1 will automatically flow through into your File 2 query

 

Ps. Please mark this answer as solution when it helped you to resolve your question, thanks!

View solution in original post

Syndicate_Admin
Administrator
Administrator

Hi @Syndicate_Admin 

    Try in the Power Query -->Advance Editor

let
Source = Csv.Document(File.Contents(""),[Delimiter=",", Columns=37,Encoding=1252, QuoteStyle=QuoteStyle.None]),
// Get column names from file 1
columnNames = Table.ColumnNames(Source),
// Source for file 2, selecting all columns from file 1
Source2 = Table.SelectColumns(Source, columnNames)
in
Source2

 

Ps. Please mark this answer as solution if it helped you to resolve your question, Thanks!

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hi @Syndicate_Admin 

    Try in the Power Query -->Advance Editor

let
Source = Csv.Document(File.Contents(""),[Delimiter=",", Columns=37,Encoding=1252, QuoteStyle=QuoteStyle.None]),
// Get column names from file 1
columnNames = Table.ColumnNames(Source),
// Source for file 2, selecting all columns from file 1
Source2 = Table.SelectColumns(Source, columnNames)
in
Source2

 

Ps. Please mark this answer as solution if it helped you to resolve your question, Thanks!

That works too ! Thanks you @Syndicate_Admin ! 

m_dekorte
Super User
Super User

Hi @Flo_19,

 

You can create a reference to file 1, that will always get you the final result from the File 1 query

The code will look like this: Source = #"file 1"

 

The easiest way to create a reference to another query is to right click the query you want to reference and select reference in the option list. Know that any future changes to File 1 will automatically flow through into your File 2 query

 

Ps. Please mark this answer as solution when it helped you to resolve your question, thanks!

Thank you for your help and your reactivity @m_dekorte !

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors