Unsolved Reading data from an excel file using qfiledislog
-
@emeka_o Of course you can. But then you will have to parse the file by yourself which is a hard to achieve task as the format is complex. That's why I gave you a link where it is described how you can read Excel files.
-
Would it be the same method for a .txt file?
-
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 -
Will this be able to open any csv file without putting the file name in the code?
-
@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
-
-
thank you