Giter Site home page Giter Site logo

read-excel's Introduction

License: MIT

This is very simple implementation of the Excel 97-2003 format (BIFF8) written in C++. Supported reading only.

Partially supported reading of BIFF7 standard (Excel 95). If in global will be set BIFF7, and in worksheets will be set BIFF8, as in test/data/strange.xls, then such file will be loaded. This feature is tested less of all, so if you will find an issue, please commit a new issue. For BIFF7 support implemented reading of LABEL records, cell with non-unicode string. I found difference between the documentation that I have and actual record in XLS file, so I implemented by experimenting with real file, that opens with Libre Office, MS Office and Google Sheets, so I believe that there is an issue in the documentation of LABEL record.

Thanks for using this library.

Comparison

I found on GitHub pure C libxls library with almost identical functionality. Dry numbers say that test/complex test with read-excel runs by 326 ms, whereas this test with libxls runs by 302 ms, what is almost identical. But C++ this is higher abstraction, that allows to use read-excel more developer friendly, and read-excel is cross-platform out of the box.

Example

try {
	Excel::Book book( "sample.xls" );

	Excel::Sheet * sheet = book.sheet( 0 );

	std::wcout << L"There is output of the \"sample.xls\" Excel file."
		<< std::endl << std::endl;

	std::wcout << L"A1 : " << sheet->cell( 0, 0 ).getString()
		<< std::endl;
	std::wcout << L"A2 : " << sheet->cell( 1, 0 ).getString()
		<< L" B2 : " << sheet->cell( 1, 1 ).getDouble() << std::endl;
	std::wcout << L"A3 : " << sheet->cell( 2, 0 ).getString()
		<< L" B3 : " << sheet->cell( 2, 1 ).getDouble() << std::endl;
	std::wcout << L"A4 : " << sheet->cell( 3, 0 ).getString()
		<< L" B4 : " << sheet->cell( 3, 1 ).getFormula().getDouble()
		<< std::endl;
	std::wcout << L"A5 : " << sheet->cell( 4, 0 ).getString()
		<< std::endl << L"Date mode is : "
		<< ( book.dateMode() == Excel::Book::DateMode::Dec31_1899 ?
				L"count of days since 31 December 1899 :" :
				L"count of days since 01 January 1904 :" )
		<< L" B5 : " << sheet->cell( 4, 1 ).getDouble()
		<< " days." << std::endl;

	std::wcout << std::endl << L"Thats all. And thanks for using this library."
		<< std::endl;
}
catch( const Excel::Exception & x )
{
	std::wcout << x.whatAsWString() << std::endl;
}
catch( const std::exception & )
{
	std::wcout << L"Can't open file." << std::endl;
}

read-excel's People

Contributors

ggeenn avatar igormironchik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

read-excel's Issues

It's not able to read datetime cell

Hello sir
I have try to read a cell which is datetime type,it doesn't work
wstring availdatew = sheet->cell(0, 6).getString();
availdatew is empty when using getString() method,thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.