Working with Excel cells

issues
excel-loop

#1

Hello,

I am automating the simple application as shown in demo. I was trying to get the symbol name from A2 cell. Enter it to nseindia website and getting the Company name, Open Price, Last Trading Price, Previous Close Price and pasting in the respective coulmns like B2, C1, D1 and E1 Cells.

but when I am putting loop it goes to infinite loop as every time the application clicks on the same cell and after that I am pressing down key so I always getting only A3 symbol and the data is pasted in the B2, C1, D1 and E1 Cells for the seond symbol also.

Is there any way where we can generate the cells numbers from vaibale and set the value into cell without opening the excel file.

I know the we can use the set cell value but it does not allow the variable to be used.


#2

I am having difficulty with this as well. Can you share your code?


#3

In this case my experience is that you should use keystrokes instead of the “Excel” action group, and you should use clipboard and variables smartly to avoid infinite loop. Would be helpful if you paste you sequences here to check where goes wrong


#4

sample 1.zip (7.6 KB)


#5

// UTILS CODE SECTION START
enableTypeOnScreen();
// UTILS CODE SECTION END
window("[CLASS:XLMAIN;TITLE:RPA Example.xlsx - Excel]");
sleep(1500);
def i0 = current;
i0 = current.toPlainString();
sendKeys(com.workfusion.studio.rpa.recorder.code.GetAutoitTextMethod.escapeText(String.valueOf(i0)));
sendKeys("{RIGHT}");
sendKeys("{RIGHT}");
sendKeys("{RIGHT}");
sendKeys("{RIGHT}");
sleep(700);
sendKeys("{CTRLDOWN}v{CTRLUP}");
sleep(500);
sendKeys("{LEFT}");
sendKeys("{LEFT}");
sendKeys("{LEFT}");
sleep(700);
sendKeys("{CTRLDOWN}c{CTRLUP}");
sendKeys("{RIGHT}");
def i1 = current;
i1 = current.toPlainString();
sendKeys(com.workfusion.studio.rpa.recorder.code.GetAutoitTextMethod.escapeText(String.valueOf(i1)));
sendKeys("{RIGHT}");
sendKeys("{RIGHT}");
sleep(600);
sendKeys("{CTRLDOWN}v{CTRLUP}");
$(byImage(“1498754240745-anchor.apng”, 0, 0)).click();
window("[CLASS:TaskListThumbnailWnd]");
sleep(1200);
$(byImage(“1498754242329-anchor.apng”, 0, 0)).click();
window("[TITLE:FirefoxPortable]");
try {
try {
mouse().mouseDown($(byImage(“1498754243001-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754243496-anchor.apng”, 0, 0)).getCoordinates());
}
sleep(1600);
try {
try {
sleep(1600);
mouse().mouseDown($(byImage(“1498754244649-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754245065-anchor.apng”, 0, 0)).getCoordinates());
}
sleep(3100);
$(byImage(“1498754247665-anchor.apng”, 0, 0)).click();
$(byImage(“1498754330480-anchor.apng”, 0, 3)).click();
sleep(800);
window("[CLASS:_sp;TITLE:_sp]");
$(byImage(“1498754331697-anchor.apng”, 0, 0)).hover();
sleep(1100);
$(byImage(“1498754332840-anchor.apng”, 0, -5)).hover();
sleep(3200);
$(byImage(“1498754336056-anchor.apng”, 0, -1)).hover();
sleep(2400);
window("[CLASS:MozillaWindowClass;TITLE:Mozilla Firefox]");
sleep(3500);
try {
try {
sleep(3500);
mouse().mouseDown($(byImage(“1498754342009-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754342513-anchor.apng”, 0, 0)).getCoordinates());
}
sleep(1200);
$(byImage(“1498754343153-anchor.apng”, 0, 0)).click();
sleep(700);
sendKeys(“cnn”);
sleep(800);
sendKeys("{ENTER}");
sleep(3100);
try {
try {
sleep(3100);
mouse().mouseDown($(byImage(“1498754348362-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754349448-anchor.apng”, 0, 0)).getCoordinates());
}
sleep(2000);
try {
try {
sleep(2000);
mouse().mouseDown($(byImage(“1498754350456-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754351265-anchor.apng”, 0, 0)).getCoordinates());
}
sleep(4100);
try {
try {
sleep(4100);
mouse().mouseDown($(byImage(“1498754354593-anchor.apng”, 0, 0)).getCoordinates());
} finally {
}
} finally {
mouse().mouseUp($(byImage(“1498754356440-anchor.apng”, 0, 0)).getCoordinates());
}


#6

Hi Girish, I’ve posted my code, is there a way I can upload the actual file directly? I’ve saved it but am not sure where it is located within the directory.


#7

@girish_chaudhar, @George_DI_Fede, @zhang_liping_in

please see this topic with solution - How to read excel spreadsheet to a List or Table variable