let
LaptopPath = "C:\OneDrive\Documents\Excel Files\Anditsgone Excell and CSV Files\CSV Files\eBay Invoices",
Desktop1Path = "D:\OneDrive\Documents\Excel Files\Anditsgone Excell and CSV Files\CSV Files\eBay Invoices",
Desktop2Path = "G:\OneDrive\Documents\Excel Files\Anditsgone Excell and CSV Files\CSV Files\eBay Invoices",
LaptopTest = try List.Count(Folder.Files(LaptopPath)[Content]),
Desktop1Test = try List.Count(Folder.Files(Desktop1Path)[Content]),
Desktop2Test = try List.Count(Folder.Files(Desktop2Path)[Content]),
Source = if LaptopTest[HasError] then
if Desktop1Test[HasError] then
if Desktop2Test[HasError] then
"Cannot find Data Source"
else
Folder.Files(Desktop2Path)
else
Folder.Files(Desktop1Path)
else
Folder.Files(LaptopPath)
#"Combined Binaries" = Binary.Combine(Source[Content]),
#"Imported CSV" = Csv.Document(#"Combined Binaries",[Delimiter=",", Columns=8, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(#"Imported CSV",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",7),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows"),
#"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each ([Fee type] <> "" and [Fee type] <> "Fee type" and [Fee type] <> "N/A")),
#"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows","Date",Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false),{"Date.1", "Date.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Date.1", type date}, {"Date.2", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date.2", "VIN/Serial number"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Removed Columns",{{"Date.1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type2",{{"Date.1", "Date"}, {"Item", "eBay Listing Number"}}),
#"Changed Type3" = Table.TransformColumnTypes(#"Renamed Columns",{{"Amount", Currency.Type}, {"Promotional savings", Currency.Type}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type3", each ([Amount] <> null)),
#"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows1",{"Promotional savings", "ReceivedTopRatedDiscount"})
in
#"Removed Columns1"