I am trying to write a program that will read values from spreadsheets and stuff and I know I need to use CSV files instead of Excel files and stuff, but say I want to just read a single entry at a specific coordinate how do I access that one instead of the entire thing?

I'm really trying to avoid having to read the entire thing and use massive arrays and hold everything in the program and access it that way.

Recommended Answers

All 4 Replies

well depends on what your doing :). if your making a forms aplication its pretty easy. you just put the CSV file into your project. i userly make a new file called data and put it there.

then in the toolbox view look for data and then data sorce and put it to your form then you can link the data sorce to your database and go from there. tbh i havent looked into reading line by line my self.

if your doing a comand line im not sure how to do that :) i need to look it up. but im sure someone else will replie before i can look it up and figure it out for you. however if know one has before tomorrow (im goign to bed now) then ill figure it out and let you know

Kind Regards,
cgcgames

commented: wtf? datasource? -2

well depends on what your doing :). if your making a forms aplication its pretty easy. you just put the CSV file into your project. i userly make a new file called data and put it there.

then in the toolbox view look for data and then data sorce and put it to your form then you can link the data sorce to your database and go from there. tbh i havent looked into reading line by line my self.

if your doing a comand line im not sure how to do that :) i need to look it up. but im sure someone else will replie before i can look it up and figure it out for you. however if know one has before tomorrow (im goign to bed now) then ill figure it out and let you know

Kind Regards,
cgcgames

The type of program is a thing someone asked me to do where you input a few things and it then determines the price or whatever depending on what you input. (Say you want option A with a size of 23 it will find the corresponding cell and display the price)

Also posting examples of the code would be extremely helpful as this is my first real foray into this type of programming, I mostly use the command prompt or the Allegro library for games.

Member Avatar for iamthwee

There's no need to use datasources or the like.

Yes, you are right in saying csv files are easier to use than excel files.

In my opinion, I would opt for tab separated files as they are easier to parse.

I have created a free excel to tab converter which is totally free to use and can be used for massive batch conversions.

However, if you already have your files as csv or tabs your task is pretty simple.

Parse each line as a vector. Use the delimiter either a tab or comma and split it into chunks. Then you're done.

Post some code kid.

Member Avatar for iamthwee

There's no need to use datasources or the like.

Yes, you are right in saying csv files are easier to use than excel files.

In my opinion, I would opt for tab separated files as they are easier to parse.

I have created a free excel to tab converter which is totally free to use and can be used for massive batch conversions.
http://www.daniweb.com/forums/thread297449.html


However, if you already have your files as csv or tabs your task is pretty simple.

Parse each line as a vector. Use the delimiter either a tab or comma and split it into chunks. Then you're done.

Post some code kid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.