Jump to content

[Request] Excel functions worfklow (csv provided)


Recommended Posts

Hello,

 

I managed to get a list of Excel functions with their translations in 15 languages

I train people on spreadsheet usage in several languages, so I sometimes have to find the translated version of a function.

My idea would be to have a workflow which would:

 

1. Display the full list of functions with their description

2. Display the translation for a given function in a user selected language

3. Copy the translation to the clipboard

 

Of course, I have no idea on how to do that.

 

I have a csv with all the data here.

 

And I looked up the format Alfred works with, which is XML. It should look like this:

<items>
       
    <item uid="function" arg="https://support.office.com/en-us/article/ABS-function-3420200f-5628-4e8c-99da-c99d7c87713c" valid="yes" autocomplete="ABS">
        <title>ABS</title>
        <subtitle>Math and trigonometry: Returns the absolute value of a number</subtitle>
        <subtitle mod="cmd">Translation in user selected language</subtitle>
        <text type="copy">Translation copied in clipboard</text>
    </item>
           
    <item uid="function" arg="https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74" valid="yes" autocomplete="ACCRINT">
        <title>ACCRINT</title>
        <subtitle>Financial: Returns the accrued interest for a security that pays periodic interest</subtitle>
        <subtitle mod="cmd">Translation in user selected language</subtitle>
        <text type="copy">Translation copied in clipboard</text>
    </item>

</items>

I used the workflow template to test this simple schema, but the link doesn't work. I didn't have much hope though, I have no relevant expertise.

 

If someone wants to give it a go, I send you all my gratitude in advance.

 

Thanks!

 

Link to comment

Wait a minute. Did you generate that XML or did you write it by hand? What exactly do you have apart from the CSV file? Any code?

 

(BTW, you should probably use the function name as the item UID. Giving everything the same UID entirely defeats the purpose of a Unique ID…)

Link to comment

Thanks for your feedback!

 

You're right to use the URL as arg, but you have to connect it to something that can use the URL, like an Open URL action.

 

I'm not seeing how the translations fit into this.

 

I'm not sure how the translation would fit there either.

The simplest way I thought of would be to have the translation appear in the subtitle when pressing cmd while highligting a function. And pressing the CMD would copy the translated function. It appeared to me that it would be easy to encode this behaviour directly in the XML, which would mean that a CSV/XML converter would be all I needed, as long as I understood how Alfred expect its XML.

 

The optimal way would be to have each function as a potential argument. It would look like:

Step 1:
Excel 
1. ABS
2. ACCRINT

Step 2:

Excel ABS
1. French translation
2. Spanish translation
3. etc

The Packal workflow has this behaviour, as a reference.

 

But I don't have the skills to do that.

 

 

Wait a minute. Did you generate that XML or did you write it by hand? What exactly do you have apart from the CSV file? Any code?

 

(BTW, you should probably use the function name as the item UID. Giving everything the same UID entirely defeats the purpose of a Unique ID…)

 

I used an online CSV/XML converter (a bad one, I need to find a better one), and pasted the first bit of the resulting XML in the workflow. It works somewhat, but the CMD press does nothing so far.

 

Capture%20d%27%C3%A9cran%202016-03-31%20

 

So nothing but the CSV, zero line of code.

I wasn't sure about the UID, thanks for the tip.

Edited by Cedric
Link to comment

Alfred doesn't actually do anything when you press CMD (apart from show the alternate subtitle). You have to use CMD+ENTER.

 

Thing is, unless you're willing to wait for Alfred 3 (which can filter lists for you), you need to write code to do what you want. Without code to filter the list based on your query, you're just going to be looking at a list of hundreds of items.

 

I've built you a very basic workflow that filters the list of functions for you based on English function name.

 

It currently doesn't do anything with the results, though, because I don't know what you want to do with them.

 

Be aware that showing two levels of data in Alfred is a relatively complex thing to do because Alfred 2 isn't built that way. I understand that will also become a lot simpler in 3.

Link to comment

Alfred doesn't actually do anything when you press CMD (apart from show the alternate subtitle). You have to use CMD+ENTER.

 

Thing is, unless you're willing to wait for Alfred 3 (which can filter lists for you), you need to write code to do what you want. Without code to filter the list based on your query, you're just going to be looking at a list of hundreds of items.

 

I've built you a very basic workflow that filters the list of functions for you based on English function name.

 

It currently doesn't do anything with the results, though, because I don't know what you want to do with them.

 

Be aware that showing two levels of data in Alfred is a relatively complex thing to do because Alfred 2 isn't built that way. I understand that will also become a lot simpler in 3.

 

 

This is great, thanks a lot!

 

This is an example I will be able to tweak in the future for similar needs, which is awesome.

 

What I wanted to do was:

  • Be able to find an English function name, with the subtitle showing the description
  • From there, be able to display the French translation of the function, and copy it in the clipboard
  • Additionnaly I would have been able to open the English description webpage of the function using a modifier like ALT+ENTER

What I tried to do was:

  1. Display the list of functions in Alfred (with their description as subtitle), so I could filter them
  2. Display the French translation using a modifier, like CMD
  3. Copy the translation using CMD+ENTER

This is why I added these to my xml

<subtitle mod="cmd">Translation in user selected language</subtitle>
<text type="copy">Translation copied in clipboard</text>

But it clearly didn't work.

 

What I wish I could do, ideally, would be

 

  1. To be able to set the second language with which I want the worfklow to work (e.g. with a XLANG [language] command)
  2. Then be able to search for an English function, with the subtitle showing the description (e.g. with an XL command)
  3. From there, be able to show the translation of the function in the user-defined language (via XLANG) and copy it in the clipboard

Additionally, the workflow would

  • At step 2, allow me to open a webpage with the English description of the function using a modifier like ALT+ENTER

I took into consideration the fact that a 2-step process is hard to do currenly. I saw several worflows (Lastpass, Date Calculator, TimeZones) which allow a specific command to set user-defined parameters that affect other commands, so maybe it's easier that way?

 

Thanks so much for your help.

Edited by Cedric
Link to comment

Yeah, it would be much easier to implement such that you set the language and all results are in that language till you change it again.
 
It's probably much more useful to use, as well, unless you're planning to use it at the United Nations.
 
What I would suggest is using the URL for "arg", so you can pass it to an Open URL action. Put the translation in the CMD-modified subtitle and also in the copytext and largetext. Then you can view it in the subtitle by holding CMD, copy it with CMD+C or show it in Alfred's big 'ol text screen with CMD+L.

Link to comment

Yeah, it would be much easier to implement such that you set the language and all results are in that language till you change it again.

 

It's probably much more useful to use, as well, unless you're planning to use it at the United Nations.

 

What I would suggest is using the URL for "arg", so you can pass it to an Open URL action. Put the translation in the CMD-modified subtitle and also in the copytext and largetext. Then you can view it in the subtitle by holding CMD, copy it with CMD+C or show it in Alfred's big 'ol text screen with CMD+L.

 

 

Could you give me some pointer about how to set the language?

I'm not sure where to start to make this happen.

 

Thanks!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...