Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trimming column names & values #330

Open
Daemach opened this issue Aug 2, 2023 Discussed in #329 · 3 comments
Open

Trimming column names & values #330

Daemach opened this issue Aug 2, 2023 Discussed in #329 · 3 comments

Comments

@Daemach
Copy link

Daemach commented Aug 2, 2023

Discussed in #329

Originally posted by Daemach August 2, 2023
@cfsimplicity I found my first CSV file today that looks like the one below. Can spreadsheet-cfml trim column names and values? I'll have to handle the non numerics, but auto-trimming would be lovely.

 costBasisPerShare  ,purchaseDate,sedol,cusip,isin,ticker,factsetID,shares
 109.60 ,1/1/2020,,,,ABBV,,51
 110.19 ,1/1/2020,,,,ABT,,37
 117.25 ,1/1/2020,,,,AJG,,50
 138.07 ,1/1/2020,,,,AMAT,,33
 504.55 ,1/1/2020,,,,AVGO,,9
 38.12 ,1/1/2020,,,,BAC,,153
 59.61 ,1/1/2020,,,,BK,,86
 695.75 ,1/1/2020,,,,BLK,,11
 63.32 ,1/1/2020,,,,BMY,,95
 63.52 ,1/1/2020,,,,C,,57
 202.96 ,1/1/2020,,,,CAT,,40
 163.56 ,1/1/2020,,,,CCI,,30
 41.77 ,1/1/2020,,,,CFG,,67
 54.94 ,1/1/2020,,,,CMCSA,,129
 50.11 ,1/1/2020,,,,COP,,97
 50.87 ,1/1/2020,,,,CSCO,,211
 30.88 ,1/1/2020,,,,CSX,,191
 -   ,1/1/2020,,,,CVX,,90
 232.96 ,1/1/2020,,,,DHR,,18
 60.71 ,1/1/2020,,,,DOW,,125
@bdw429s
Copy link

bdw429s commented Nov 3, 2023

Possibly related to this bug
#339

@cfsimplicity
Copy link
Owner

@bdw429s I don't think so. The trim option in #339 just removes leading/trailing space from the whole CSV string, whereas this issue is about trimming individual column names/values, which seems to happen anyway (i.e. I haven't been able to replicate it). See the related discussion.

@cfsimplicity
Copy link
Owner

@Daemach Again could you see if the new readCsv() helps here?

https://github.com/cfsimplicity/spreadsheet-cfml/blob/develop/test/specs/readCsv.cfm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants