Excel get cell

Discuss RoboTask here
Post Reply
marcolobaido
Posts: 70
Joined: Thu Jul 02, 2015 3:54 pm

Excel get cell

Post by marcolobaido »

Hi everybody,
I used the "excel get cell" command but it extract <LF>cell content<LF>.
How can i extract only the cell content?
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Excel get cell

Post by Oleg »

I tried the action, it retrieves only cell value without "Line Feed" symbols.
In any case you can use STR Trim action to trim unnecessary symbols
Oleg Yershov
marcolobaido
Posts: 70
Joined: Thu Jul 02, 2015 3:54 pm

Re: Excel get cell

Post by marcolobaido »

Actually I use "get cell" from an excel sheet automatically generated by a software...I tried with a new excel sheet and "get cell" works perfectly...
Thanks for the answer, I'll use STR Trim ;)
Rigter
Posts: 3
Joined: Sat Apr 15, 2017 3:05 am

Re: Excel get cell

Post by Rigter »

Hello,

I'm trying Robotask, and I'm having some hard time to get excel cells.
The intention is to copy the cell content and past the values on a webiste.
But wit the task get cell, is closes the excel workbook everytime.
Can you post a simple example with the steps ?

What should I set on list of cell -"variable name" ??
If copy task from clipboard is suficient ?

Help will be appreciated.
Many thanks.
Rigter
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Excel get cell

Post by Oleg »

Look a my example below.
This task opens the Excel document and read cells from 1-st page.
It read cells C4-C10 and put values to variables VAR1-VAR7 correspondingly

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|2091586075
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task259"
Hide=INTEGER|0
ID=INTEGER|-12526969
LogOnAsUser=INTEGER|1
Name=STRING|"Get cells from to variables"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_EXCEL_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Excel Open Document"
Params=FOLDER

[Actions\Action1\Params]
filename=STRING|"D:\Temp\test.xls"
hide=STRING|"1"
mode=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_EXCEL_GET"
Enabled=INTEGER|-1
Name=STRING|"Excel Get Cells"
Params=FOLDER

[Actions\Action2\Params]
cell00000000=STRING|"c4"
cell00000001=STRING|"c5"
cell00000002=STRING|"c6"
cell00000003=STRING|"c7"
cell00000004=STRING|"c8"
cell00000005=STRING|"c9"
cell00000006=STRING|"c10"
count=STRING|"7"
var00000000=STRING|"var1"
var00000001=STRING|"var2"
var00000002=STRING|"var3"
var00000003=STRING|"var4"
var00000004=STRING|"var5"
var00000005=STRING|"var6"
var00000006=STRING|"var7"
worksheet=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""cell values are:"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"cell values are:"
msg1=STRING|"c4 = {var1}"
msg2=STRING|"c5 = {var2}"
msg3=STRING|"c6 = {var3}"
msg4=STRING|"c7 = {var4}"
msg5=STRING|"c8 = {var5}"
msg6=STRING|"c9 = {var6}"
msg7=STRING|"c10 = {var7}"
msgcount=STRING|"8"
playsound=STRING|"0"
showmessage=STRING|"1"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Oleg Yershov
Rigter
Posts: 3
Joined: Sat Apr 15, 2017 3:05 am

Re: Excel get cell

Post by Rigter »

Thanks a lot Oleg!

Excellent.

Can the Robotask, not close the excel, after the task is completed?
My issue, is because the destination of the data is very limited, I will have to copy one value and paste it on the website, one value/cell at a time....
TasK will be:
Open Excel
Get cell C1
Copy value
Go to website
Paste value
Save
and, loop

Thank you again.
Regards,
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Excel get cell

Post by Oleg »

Excel application will be closed when task finish in any case.
You can get cells in the loop (for example Text Loop)
Also you can get necessary data into separate variables (as in my example)
Oleg Yershov
Rigter
Posts: 3
Joined: Sat Apr 15, 2017 3:05 am

Re: Excel get cell

Post by Rigter »

Thanks Oleg.

I'm missing to find a very simple way to past the variables values.
As on your example, I'm able to get and create the necessary data into separate variables.
And now I want to paste each variable as text on another document or webpage.
What is the best way to paste variables (only text) after the get excel cells ?

Thanks again.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Excel get cell

Post by Oleg »

You can paste variable values by using Clipboard actions
Use Put Text action to put some text (with variables, of course) to clipboard
Use Paste to put clipboard text into some input field
Oleg Yershov
Post Reply