Reading data from an excel file using qfiledislog
-
@jsulm oh my bad. Can I use qfile to open an excel file to read the data from it and store it?
-
Hi
What type of text file ?say if you had a comma separated values file ( a text file )
then it would be much easier to read into a Qt program and do something with it.so if you saved from excel a CSV file it would be easy to read in Qt.
-
Hi
What type of text file ?say if you had a comma separated values file ( a text file )
then it would be much easier to read into a Qt program and do something with it.so if you saved from excel a CSV file it would be easy to read in Qt.
-
@mrjj how do I open and read a csv file to get the variables to store in let’s say a vector
Hi
With Qfile and QString and its split function.
You would loop over each line and then split on comma or Tab (as excel uses)
like here. first answer
https://stackoverflow.com/questions/27318631/parsing-through-a-csv-file-in-qtor you could use a lib
https://github.com/iamantony/qtcsv -
@emeka_o said in Reading data from an excel file using qfiledislog:
Will this be able to open any csv file without putting the file name in the code?
For that use QFileDialog to let the user select the file to open and then open it using QFile, is really not that hard. Or what is your use case?
-
I want the user to be able to select the csv file and I want to be able to save the the data in variables