hi i'm currently making a program relating to money and i need my c++ to read one of my excel files which has all the prices etc in it

how do i make it work? =/

Recommended Answers

It's very hard to read an excel file, but you could try reading an Excel XML file.

Jump to Post

Save the Excel file out as a CSV file and read it in like any other text file (with ifstream, etc.).

Jump to Post

All 5 Replies

It's very hard to read an excel file, but you could try reading an Excel XML file.

Save the Excel file out as a CSV file and read it in like any other text file (with ifstream, etc.).

Or quite possibly as a tab delimited file. . . It's even easier to parse.

try this library - http://www.libxl.com

hi i'm currently making a program relating to money and i need my c++ to read one of my excel files which has all the prices etc in it

#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{	
	char continue = 'N';
	fstream fileExcel;
	fileExcel.open("myfile.xls", ios::in);
	do{	
		char strLine[100];
		fileExcel.getline(strLine,99);
		cout << strLine;
		cout <<"\nType N if you want to stop\n";
		cin >> continue;		
	}while (continue != 'N');
	system("PAUSE");
	return 0;
}
Be a part of the DaniWeb community

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