Forum Discussion
Dealing with Large Datasets
Thank you for such a quick response!
I did see the CSV parameters and for columns it does say for columns you can use "a list of column names" but when I list the columns as they are in my first row (example below) it just names them but doesn't select those columns. I tried finding if there was a way to select certain columns in CSV, but with no luck.
Example data:
"InsuredID","AccountName","PlanName","FirstName","MiddleInitial","LastName","IndivTripCostInsured","DepartDate","ReturnDate","CovgBeginDate ","CovgEndDate"
Example code (pulls first two columns and names the respective column InsuredID and PlanName:
= Csv.Document(File.Contents("Z:\Data\Travel\Legacy Data\Premium\AXA_PREM.csv"),[Delimiter=",", Columns={"InsuredID", "PlanName"}, Encoding=1252, QuoteStyle=QuoteStyle.None])
Example code (pulls first two columns and names the respective column Column1 and Column3:
= Csv.Document(File.Contents("Z:\Data\Travel\Legacy Data\Premium\AXA_PREM.csv"),[Delimiter=",", Columns={"Column1", "Column3"}, Encoding=1252, QuoteStyle=QuoteStyle.None])
Anonymous tested and yes I can confirm the usage of list inside column parameter
Csv.Document(File.Contents("C:\Users\X\Desktop\csv.csv"),[Delimiter=",", Columns={"Column1","Column3"}, Encoding=65001, QuoteStyle=QuoteStyle.None])
- Anonymous5 years agoNot applicable
When I tested that code, it renamed columns 1 and 2 as "Column1" and "Column3", respectively, rather than pulling columns 1 and 3. As you mentioned in your first response, it seems to pull left to right rather than being able to select defined columns.