# Linux Commands in Excel

**URL:** <https://forum.robotframework.org/t/linux-commands-in-excel/6899>\
**Category:** Robot Framework\
**Created:** [25 February 2024 21:29 UTC](https://forum.robotframework.org/t/linux-commands-in-excel/6899 "2024-02-25T21:29:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricdingal](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ricdingal/32/3512_2.png) [@ricdingal](https://forum.robotframework.org/u/ricdingal)\
**Post date:** [25 February 2024 21:29 UTC](https://forum.robotframework.org/t/linux-commands-in-excel/6899/1 "2024-02-25T21:29:20Z")

</div>

Hello experts greetings to you all,

I am a newbie

Here is my question; in my excel files linux commands are listed and placed in different cell address.  
like:

A2 linuxcommand1  
A5 linuxcommand1  
A7 linuxcommand3  
A100 linuxcommand4

now how will I pullout these linux commands using robotframework and execute them in a remoteserver?

If you can correct my code with the error below

\*\*\* Settings \*\*\*  
Library SSHLibrary  
Library ExcelLibrary

\*\*\* Variables \*\*\*  
${HOST} 192.168.100.117  
${USERNAME} root  
${PASSWORD} Hitokiri  
${PORT} 22  
${EXCEL\_FILE} D:/dev/linuxcommands.xlsx  
${SHEET\_NAME} Sheet1

\*\*\* Test Cases \*\*\*  
Execute Commands On Remote Server  
[Documentation] Execute commands on a remote Linux server  
[Setup] Open Excel Document ${EXCEL\_FILE} ${SHEET\_NAME} mode=r  
${ssh} Open Connection ${HOST} port=${PORT}  
SSHLibrary.login ${USERNAME} ${PASSWORD}  
@{command\_cells}= Create List A2 A3 A5 A7 A10 A13 A22  
FOR ${cell} IN @{command\_cells}  
${command}= Read Excel Cell ${SHEET\_NAME} ${cell}  
Run Keyword If ‘${command}’ != ‘’ Execute Command On Remote Server ${command}  
END  
[Teardown] Close All Connections

\*\*\* Keywords \*\*\*  
Execute Command On Remote Server  
[Arguments] ${command}  
${output}= SSHLibrary.Execute Command ${HOST} ${USERNAME} ${PASSWORD} ${command}  
Log ${output}

error: Execute Commands On Remote Server :: Execute commands on a remote … | FAIL |  
ValueError: Argument ‘row\_num’ got value ‘Sheet1’ that cannot be converted to integer.

thank you

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [26 February 2024 00:15 UTC](https://forum.robotframework.org/t/linux-commands-in-excel/6899/2 "2024-02-26T00:15:01Z")

</div>

the issue would seem to be this line:

![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/5/5ebf9ed859a887a297d818999e8776090bacf1a4.png)

If its the same library I [**Use**](https://pypi.org/project/robotframework-excellib/) then Read Excel Cell doesn’t require the sheetname passed as the first arg, but the row first and the col number second unless you prefix them, please see below:

`Read Excel Cell	row_num=1	col_num=1`

I think most if not all excel libs, are the same in term of needing the row and col, docs do suggest you can pass sheet\_name as third arg if the same library, but as you have that sheet open a little further up, you dont need to pass it:

> **Args:**  
> _row\_num_: row number, starts with 1.  
> _col\_num_: column number, starts with 1.  
> _sheet\_name_: sheet name, where placed cell, that need to be read.

But ulimately, its falling over as its expecting the row number, which your error speaks of yet its recieving text “Sheet1”:

![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/3/32c02259ec410c66fdf5d0dbb48566932bd8aa87.png)

Thanks

---

<div class="post-metadata">

**Author:** ![ricdingal](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ricdingal/32/3512_2.png) [@ricdingal](https://forum.robotframework.org/u/ricdingal)\
**Post date:** [26 February 2024 00:53 UTC](https://forum.robotframework.org/t/linux-commands-in-excel/6899/3 "2024-02-26T00:53:23Z")

</div>

Thank you for the reply I will try
