# reading input from LibreOffice Calc .ods

**URL:** <https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991>\
**Category:** Ansible Project\
**Created:** [June 20, 2013, 1:55am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991 "2013-06-20T01:55:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [June 20, 2013, 1:55am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/1 "2013-06-20T01:55:57Z")

</div>

Hi all,

Is it possible to get input from .ods and place it in playbook for execution?

Taking copy action for an example.

action: copy src=/home/celine/Desktop/fileA dest=/home/celine2/Desktop/fileB  
^ ^  
Instead of directly input “fileA” and “fileB”, can i read these from .ods spreadsheet? Suppose “fileA” is on spreadsheet cell number D22 and “fileB” is on E22.

Thank you.

Celine

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 20, 2013, 2:47am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/2 "2013-06-20T02:47:01Z")

</div>

You could write a lookup plugin that looked like this:

{{ lookup(“ods”, “foo.ods B22”) }}

For more information on lookup plugins see the “lookup\_plugins” directory in the example source. How the “file” lookup plugin works is pretty basic, and you could see how to adapt it.

---

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 1, 2013, 3:14am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/3 "2013-07-01T03:14:46Z")

</div>

Hi Michael,

I have been looking up on how to write a lookup plugin for some time. But i am still getting to nowhere.

Can you give me some guidance on how to do it?

Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 1, 2013, 1:56pm UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/4 "2013-07-01T13:56:00Z")

</div>

Can you tell me what you’ve tried so far and where you got stuck?

---

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 2, 2013, 3:03am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/5 "2013-07-02T03:03:13Z")

</div>

I found the lookup\_plugins folder in /ansible-1.2/lib/ansible/runner/lookup\_plugins. There are 15 .py files. Every .py file can be called using the lookup function. eg {{lookup(‘file’,‘/home/celine/Desktop/newText’)}}. The first lookup parameter, ‘file’ should correspond to one of the 15.py files.

For my case, I should create a ods.py file in the lookup\_plugins folder. {{ lookup(“ods”, “foo.ods,B22”) }}. Second parameter will have 2 inputs. I have looked through the different .py files and have found some similarities.

But i dont know how to use those and adapt to create the new ods plugin. I am not familiar with python but have started reading up on it.

Are you able to help to write the ods plugin? Would appreciate alot. Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 2, 2013, 6:25pm UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/6 "2013-07-02T18:25:17Z")

</div>

I don’t currently have cycles to help write the plugin for you.

Someone else here might, however.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 2, 2013, 8:29pm UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/7 "2013-07-02T20:29:03Z")

</div>

It might be MUCH easier to write a tsv (tab separated values) plugin, ods spreadsheet easily exports into that. Even csv format can get very complicated (optional diff separators, optional text delimiters, etc).

---

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 3, 2013, 1:04am UTC](https://forum.ansible.com/t/reading-input-from-libreoffice-calc-ods/12991/8 "2013-07-03T01:04:13Z")

</div>

With a tsv file, will i still be able to extract certain values instead of getting out the entire file since there is no more cell concept in tsv?

What about a text file? {{lookup(‘file’,‘/home/celine/Desktop/motd’)}} This looks up everything in file, motd. Can I specify which element in the file i wish to pick out? For instance the word in row 10, column 9 for example.

Thanks.
