Print

Import Omie Data to Google Sheets

In this guide, we’ll walk through how to pull data from the Omie API directly into Google Sheets, using the API Connector add-on for Sheets.

We'll first get an API key from Omie, and then set up a request to pull in Brazilian electronic service invoice (NFS-es) data to your spreadsheet.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Omie API Key and Secret

  1. Sign in to Omie and click the Gear icon
    omie-gear
  2. Scroll down the page until you see your API key and API secret
    omie-key
  3. Keep these handy as we'll use these shortly. You're all set! You can now connect to Omie's API.

Part 2: Pull Omie API Data into Sheets

For this example, we'll make a request to the /servicos/nfse/ endpoint (see all endpoints in the documentation)

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodPOST
    • Request URLhttps://app.omie.com.br/api/v1/servicos/nfse/
    • Headers:
      • Content-Type: application/json
    • Request body: {"call":"ListarNFSEs","app_key":"your_api_key","app_secret":"your_api_secret","param": [{"nPagina": 1,"nRegPorPagina": 500}]}
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see Omie data populate your sheet.
    omie-response

Part 3: Handle Pagination

By default, Omie returns just 50 records unless you set the "records per page" parameter in the request body to 500. The name of the pagination parameter depends on the endpoint; for example, the ListarClientes endpoint uses pagina and registros_por_pagina (for "page number" and "records per page"), while the ListarNFSEs endpoint uses nPagina and nRegPorPagina.

Please check the documentation to ensure you've configured your request with the correct pagination parameters.

ListarClientes Example

  • Pagination typepage parameter body
  • Page parameter bodyparam[].pagina
  • Run untilchoose when the request should stop running
    omie-pagina

ListarNFSEs Example

  • Pagination typepage parameter body
  • Page parameter bodyparam[].nPagina
  • Run untilchoose when the request should stop running
    omie-nPagina

Part 4: API Documentation

Official API documentation: https://developer.omie.com.br/service-list/

4 thoughts on “Import Omie Data to Google Sheets”

  1. Estou tentando usar o recurso de multiconsultas para extrair dados de contas apagar do OMIE.
    Porém, os dados a partir da pagina 2 estão vindo zerados e nao deveria. Gostaria de saber se meu código esta errado ou se tem algum outro passo antes, se preciso pagar alguma coisa.
    segue o código (coloquei a key e o secret em * apenas para representar):
    {"call":"ListarContasPagar","app_key":"*********","app_secret":"*****","param":[{"pagina":1,"registros_por_pagina":500,"apenas_importado_api":"N"}]}
    :::BREAK:::
    {"call":"ListarContasPagar","app_key":"*********","app_secret":"*****","param":[{"pagina":2,"registros_por_pagina":500,"apenas_importado_api":"N"}]}

    Reply
      • Fiz a alteração e apresentou um erro "Completed with errors
        - We received an error from omie.com.br (500) "
        Do jeito que eu escrevi funciona, mas só me traz os resultados da primeira página

Leave a Comment

Jump To