Source Using Cell Addresses

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
778
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I am trying to convert a bit of code that uses cells to hold the Folder Path and File Name. This works perfectly for Excel files. I am now trying to modify the code to import a csv fie, but failing. If anyone could offer any advice it would be much appreciated.

FilePath = Excel.CurrentWorkbook(){[Name="Folder_Path"]}[Content]{0}[Column1],
FileName = Excel.CurrentWorkbook(){[Name="File_Name"]}[Content]{0}[Column1],
Source = Excel.Workbook(File.Contents(FilePath & FileName), null, true),


FilePath = Csv.Document(){[Name="Folder_Path"]}[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None],
FileName = Csv.Document(){[Name="File_Name"]}[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None],[Content]{0}[Column1],
Source = Csv.Document(File.Contents(FilePath & FileName), null, true),
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,216,109
Messages
6,128,884
Members
449,477
Latest member
panjongshing

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top