Read Data Part from excel file

Rooters
If I want to read a limited part from excel file how can i do it!

for example in the attached excel file i want to read the 2 columns (A and B)
(from the channel A45 to channel A8236), and (B45:B8236)

file.xls.tar.gz (63.3 KB)

Save it as a .csv file first (ascii version of the Excel file) and read that saved file as a normal ascii file.

its ok, But how can i read the required data from the whole file ?

If you are able to read the cvs file it is similar to what you did before.
Just take the 45 to 8236

i make somthing like that but it the output is zero zero only

can you modify please to get the required data and get the value of time in the line number 6 !

{
double lifetime;
double data[8192], d,g;
string line;
int linenumber=0;

ifstream inputfile;
ofstream outputfile;

inputfile.open(“1.cvs”);
outputfile.open(“Run.txt”);

while (!inputfile.eof()){
getline(inputfile,line);
linenumber++;

   if (linenumber==6){
      getline(inputfile,line,',');
      inputfile>>lifetime;}

   if (linenumber>=45){
       inputfile >>d>>g;
       cout<<d<<"                  "<<g<<endl;}

     if(inputfile.eof())
     {break;}

   if(linenumber>=8192+45)
     {break;}}

inputfile.close();
outputfile.close();
cout <<“Lifetime=”<<lifetime<<endl;
}

1.csv.tar.gz (66.8 KB)

I did it,
Thank you for your help

could you help with thise !

hi,

or use rdataframe to read the csv: https://root.cern/doc/master/df014__CSVDataSource_8C.html

P

can you please re-write this line modification please ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.