Skip to content

Add the option to respond in XML format #1

@alvarocastro

Description

@alvarocastro

I use this api in Google Sheets to get the latest dollar blue price in a cell to use in other fomulaes.

Currently, sheets doesn't have a way to import and read from JSON format directly, I have to import the raw JSON and use a RegEx to extract the value:

=TEXT(REGEXEXTRACT(IMPORTDATA("https://api.bluelytics.com.ar/v2/latest","|"),"blue.+?value_buy.+?([\d\.]+)"), "0.00")

It works, but is a bit messy.

Sheets has a function to import and read XML, and the formula would be cleaner and less error prone:

=TEXT(IMPORTXML("https://api.bluelytics.com.ar/v2/latest.xml", "result/blue/buy"), "0.00")

Assuming the response is:

<result>
  <official>
    <valueavg>XXXX</valueavg>
    <valuesell>XXXX</valuesell>
    <valuebuy>XXXX</valuebuy>
  </official>
  <blue>
    <valueavg>XXXX</valueavg>
    <valuesell>XXXX</valuesell>
    <valuebuy>XXXX</valuebuy>
  </blue>
  ...
  <lastupdate>2024-12-11T12:16:12.015118-03:00</lastupdate>
</result>

Format parameter could be as an "extension": /v2/latest.xml or a query param ?format=xml

I would submit a PR myself buy don't know golang.


This API is great and very useful, thanks for the effort!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions