Forum Discussion

Darko_Giac's avatar
Darko_Giac
Icon for Helper II rankHelper II
7 years ago
Solved

Importing continuous CSV files from folder with different sheet names

Hi all,

 

I'm having an issue with power query and had posted a similar question earlier, however the problem I'm running into is slightly different. 

 

I'm exporting survey data on a weekly basis (in .csv format) to track the number of participants over the next month.

 

The variables in the export will not change, and since the number of .csv files will grow over the next few weeks in the folder connected to powerquery, refreshing power query to get a quick update normally wouldn't be an issue.

 

However, each raw data export's sheet name will differ, and I was wondering if there is a way to by-pass that step. For instance, if one week, a file comes in with the sheet name "2018-11-01", but the following week's sheet is called "2018-11-02", I have to make sure that the sheet names are uniform across exports, (my work around at the moment is to open each exported csv file and renaming the sheet to "sheet"). Is there a way that power query can read in the updated data with different sheet names for .csv files?

 

I know there's a workaround if the file is .xls/.xlsx, however the code when I import a .csv doesn't allow me to specify a sheet name, instead, this is the code I am working with:

 

let
    Source = Csv.Document(#"Sample File Parameter1",[Delimiter=",", Columns=96, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
    #"Promoted Headers"

This would be in the "Transform Sample File From..." step. 

 

In summary, I'm just looking to not have to rename the sheet of each new export.

 

Thanks!

 

Darko

3 Replies