I'm kind of stuck because I used the code that they posted there and now I don't know hot to get the file inside the Excel to show on the console.
This is the code that I used. Thank you in advance. :)
#include <iostream>
#include <fstream>
#include<string>
#include <iomanip>
#include<windows.h>
#include<conio.h>
using namespace std;
int main()
{
ifstream indata;
ofstream outdata;
string Groom, Bride, Venue, TimE, DatE;
int Guests;
outdata.open("aaaaron.csv", ios::app);
cout<<"Please enter date of the reception (Use dash to separate): ";
cin>>DatE;
cout<<"\nPlease enter time of the reception (Use colon and dash): ";
cin>>TimE;
cout<<"\nPlease enter the name of the groom: ";
cin>>Groom;
cout<<"\nPlease enter the name of the bride: ";
cin>>Bride;
cout<<"\nPlease enter the number of guests: ";
cin>>Guests;
cout<<"\nPlease enter the venue of the reception: ";
cin>>Venue;
outdata<<DatE<<','<<TimE<<','<<Groom<<','<<Bride<<','<<Guests<<','<<Venue;
outdata<<endl;
I would probably do 2 getlines. 1 to get the row (the actual line)
and another in a loop to get each column (specify a comma as the delimiter)
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13
string line;
// get one line from the csv file
getline( yourcsvfile, line );
// put that line in a stringstream so we can extract from it easily
stringstream ss(line);
// get each column:
string firstcolumn;
getline( ss, firstcolumn, ',' );
// etc, etc
Alternatively, instead of putting the line in a stringstream, you can use string::find and string::substr to extract the columns. But that's probably a bit more error prone.
Implement your excel within a mature excel reading application to get the file for console or extract all the contents in the excel file, including chart, graph and other data. Besides, if we want to get the whole excel worksheet containg the file or certain objects, we can extract the certain page out from the whole excel document.