![]() |
Read excel file in Red Lion
Hello
I am working in a project where I have to read data from an excel file. I'm not sure whether this is possible. The screen that I'm using is a Red Lion Cr3000700000420, I'm workig with Crimson 3.1 What I want to do is make a comparison from a text that is enter with a scanner and check whether this data is in the excel file. |
I never read from an Excel file, but from a text file.
In the Crimson menu, go to Help -> Reference. In the Reference manual, look for the file instructions, like OpenFile, ReaFile, etc. You need to create a program in the Programs tab. |
Like CSV? is it possible to read an specific cell with csv files?
Do you read the files from an USB or sd card? Thanks for your answer |
Quote:
In my case, I'm reading from the sd or compactflash card. |
Could you give me an example please?
I have never read files in red lion I did this program and create a tag called dato, and I tried to read the file but it didn't work. int archivo; archivo = OpenFile("Volumen.csv",0); FileSeek(archivo,23); dato = ReadFileLine(archivo); |
Quote:
/* This program reads a file where the tag names and its values are stored in */ int tagindex; int Hfile; int count; int space1; int space2; int decimal; int IntValue; float FloatValue; cstring line; cstring TagName; cstring TextValue; //Open file Hfile := OpenFile("/param/param.txt", 1); //Read a line from the file line := ReadFileLine(Hfile); //While the line read from the files retrieves something, keep reading while (Len(line)>0) { //Read the position of the first and second space occurrence //Example of line: Polisher_System.Polisher.Vibration 22 mm/s space1 := Find(line,' ',0); space2 := Find(line,' ',1); //The tag name is the section before the first space TagName := Left(line, space1); //The tag value is located between the first and the second spaces TextValue := Mid(line, space1+1, space2-space1); //Find the tag index tagindex = FindTagIndex(TagName); //Find out if the value is decimal (has a ".") decimal := Find(TextValue,'.',0); //Write the value to the corresponding tag in Crimson if (decimal == 0)//If the tag is a integer {IntValue= TextToInt(TextValue,10); SetIntTag(tagindex,IntValue);} else //If the tag is a float {FloatValue= TextToFloat(TextValue); SetRealTag(tagindex,FloatValue);} //Read a new line from the file line := ReadFileLine(Hfile); } //Close the file CloseFile(Hfile); |
Thank you very much
|
All times are GMT -5. The time now is 12:46 PM. |
.