Skip to content

Instantly share code, notes, and snippets.

@chris-b1
Created August 26, 2017 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-b1/b49e43536938826d14c8340b808ed05f to your computer and use it in GitHub Desktop.
Save chris-b1/b49e43536938826d14c8340b808ed05f to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <vector>
#include <chrono>
#include "xlnt/xlnt.hpp"
#include "xlnt/workbook/streaming_workbook_reader.hpp"
int main()
{
auto start = std::chrono::system_clock::now();
xlnt::streaming_workbook_reader wb;
wb.open("C:/Users/Chris/floats.xlsx");
wb.begin_worksheet("Sheet1");
std::vector<double> values;
while (wb.has_cell())
{
auto cell = wb.read_cell();
if (cell.row() > 1) {
values.push_back(cell.value<double>());
}
}
auto end = std::chrono::system_clock::now();
auto dur = std::chrono::duration_cast<std::chrono::milliseconds> (end - start);
std::cout << "Reading took " << (float)dur.count() / 1000 << '\n';
std::cout << values.size();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment