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

How do I get the data from a .csv file I import? #39

Closed
ErikaVasNormandy opened this issue May 17, 2016 · 5 comments
Closed

How do I get the data from a .csv file I import? #39

ErikaVasNormandy opened this issue May 17, 2016 · 5 comments
Assignees

Comments

@ErikaVasNormandy
Copy link

screen shot 2016-05-17 at 11 40 55 am

I need to have an application that can read in the values from a .csv file that I import into the project. Right now, the do statement appears to not work

@naoty
Copy link
Member

naoty commented May 18, 2016

@ASCI-Red What problems are happened? Did above code cause to crash your app? If you want to know how to use, it is better to read README and test codes like here.

@ErikaVasNormandy
Copy link
Author

The app does not crash, but I am trying to access the CSV file using CSV(name: "CSVName"). It isn't executing but just goes right to the catch statement

@elSpike
Copy link

elSpike commented May 20, 2016

I'm having exactly the same issue. Just straight to the catch statement.

Spoke to soon. Gotta use the test syntax. Change your statement to:

let csvURL = NSBundle(forClass: ViewController.self).URLForResource("InventorySheet", withExtension: "csv")!
            let csv = try CSV(url: csvURL)

@grantkemp
Copy link
Collaborator

I think we need a nice Example project - will look at adding this for the next point release

@grantkemp grantkemp self-assigned this Jan 18, 2017
@thexande
Copy link

thexande commented Jan 22, 2017

For those on Swift 3:

let csvURL = Bundle(for: ViewController.self).url(forResource: "your_csv_file_name", withExtension: "csv")! 
let csv = try CSV(url: csvURL)```

lukestringer90 pushed a commit to lukestringer90/SwiftCSV that referenced this issue Apr 4, 2020
* remove unused Variant type

* disambiguate init(name:) to mean resource name, not file paths

Fixes swiftcsv#39
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

5 participants