# Converter XML de NF-e para CSV (exemplo)

**Use case:** 

Example: parses the bundled fictitious demo NF-e and exports invoice and item CSVs. Replace with your own XML files, ZIP or URLs.

## Input

```json
{
  "xmlContent": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><nfeProc xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"4.00\"><NFe xmlns=\"http://www.portalfiscal.inf.br/nfe\"><infNFe versao=\"4.00\" Id=\"NFe35260998765432000198550010000000011202609015\"><ide><cUF>35</cUF><cNF>20260901</cNF><natOp>VENDA DE MERCADORIA</natOp><mod>55</mod><serie>1</serie><nNF>1</nNF><dhEmi>2026-09-01T10:00:00-03:00</dhEmi><dhSaiEnt>2026-09-01T10:00:00-03:00</dhSaiEnt><tpNF>1</tpNF><idDest>2</idDest><cMunFG>3550308</cMunFG><tpImp>1</tpImp><tpEmis>1</tpEmis><cDV>5</cDV><tpAmb>2</tpAmb><finNFe>1</finNFe><indFinal>0</indFinal><indPres>1</indPres><procEmi>0</procEmi><verProc>TESTE 1.0</verProc></ide><emit><CNPJ>98765432000198</CNPJ><xNome>EMPRESA FICTICIA DE TESTES LTDA</xNome><xFant>FICTICIA</xFant><enderEmit><xLgr>RUA DOS TESTES</xLgr><nro>1</nro><xBairro>SE</xBairro><cMun>3550308</cMun><xMun>São Paulo</xMun><UF>SP</UF><CEP>01001000</CEP><cPais>1058</cPais><xPais>BRASIL</xPais><fone>1130000000</fone></enderEmit><IE>111222333444</IE><CRT>3</CRT></emit><dest><CNPJ>13579246000101</CNPJ><xNome>NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL</xNome><enderDest><xLgr>AV FICTICIA</xLgr><nro>2000</nro><xBairro>SAVASSI</xBairro><cMun>3106200</cMun><xMun>Belo Horizonte</xMun><UF>MG</UF><CEP>30130010</CEP><cPais>1058</cPais><xPais>BRASIL</xPais></enderDest><indIEDest>1</indIEDest><IE>0012345670089</IE></dest><det nItem=\"1\"><prod><cProd>DEMO-001</cProd><cEAN>SEM GTIN</cEAN><xProd>PRODUTO DEMONSTRACAO A</xProd><NCM>84713012</NCM><CFOP>6102</CFOP><uCom>UN</uCom><qCom>2.0000</qCom><vUnCom>150.0000000000</vUnCom><vProd>300.00</vProd><cEANTrib>SEM GTIN</cEANTrib><uTrib>UN</uTrib><qTrib>2.0000</qTrib><vUnTrib>150.0000000000</vUnTrib><indTot>1</indTot></prod><imposto><vTotTrib>90.00</vTotTrib><ICMS><ICMS00><orig>0</orig><CST>00</CST><modBC>3</modBC><vBC>300.00</vBC><pICMS>18.00</pICMS><vICMS>54.00</vICMS></ICMS00></ICMS><PIS><PISAliq><CST>01</CST><vBC>300.00</vBC><pPIS>1.65</pPIS><vPIS>4.95</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>300.00</vBC><pCOFINS>7.60</pCOFINS><vCOFINS>22.80</vCOFINS></COFINSAliq></COFINS></imposto><infAdProd>Lote 123</infAdProd></det><det nItem=\"2\"><prod><cProd>DEMO-002</cProd><cEAN>SEM GTIN</cEAN><xProd>PRODUTO DEMONSTRACAO B</xProd><NCM>85176259</NCM><CFOP>6102</CFOP><uCom>UN</uCom><qCom>1.0000</qCom><vUnCom>89.9000000000</vUnCom><vProd>89.90</vProd><cEANTrib>SEM GTIN</cEANTrib><uTrib>UN</uTrib><qTrib>1.0000</qTrib><vUnTrib>89.9000000000</vUnTrib><indTot>1</indTot></prod><imposto><vTotTrib>26.97</vTotTrib><ICMS><ICMS00><orig>0</orig><CST>00</CST><modBC>3</modBC><vBC>89.90</vBC><pICMS>18.00</pICMS><vICMS>16.18</vICMS></ICMS00></ICMS><PIS><PISAliq><CST>01</CST><vBC>89.90</vBC><pPIS>1.65</pPIS><vPIS>1.48</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>89.90</vBC><pCOFINS>7.60</pCOFINS><vCOFINS>6.83</vCOFINS></COFINSAliq></COFINS></imposto><infAdProd>Lote 123</infAdProd></det><total><ICMSTot><vBC>389.90</vBC><vICMS>70.18</vICMS><vICMSDeson>0.00</vICMSDeson><vFCP>0.00</vFCP><vBCST>0.00</vBCST><vST>0.00</vST><vFCPST>0.00</vFCPST><vFCPSTRet>0.00</vFCPSTRet><vProd>389.90</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0.00</vII><vIPI>0.00</vIPI><vIPIDevol>0.00</vIPIDevol><vPIS>6.43</vPIS><vCOFINS>29.63</vCOFINS><vOutro>0.00</vOutro><vNF>389.90</vNF><vTotTrib>116.97</vTotTrib></ICMSTot></total><transp><modFrete>0</modFrete></transp><pag><detPag><tPag>15</tPag><vPag>389.90</vPag></detPag></pag><infAdic><infCpl>Documento emitido para testes. Pedido 4567.</infCpl></infAdic></infNFe><Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#NFe35260998765432000198550010000000011202609015\"><DigestValue>ZmFrZQ==</DigestValue></Reference></SignedInfo><SignatureValue>ZmFrZXNpZ25hdHVyZQ==</SignatureValue></Signature></NFe><protNFe versao=\"4.00\"><infProt><tpAmb>2</tpAmb><verAplic>SP_NFE_PL009_V4</verAplic><chNFe>35260998765432000198550010000000011202609015</chNFe><dhRecbto>2026-09-01T10:00:00-03:00</dhRecbto><nProt>135260000009999</nProt><digVal>ZmFrZQ==</digVal><cStat>100</cStat><xMotivo>Autorizado o uso da NF-e</xMotivo></infProt></protNFe></nfeProc>",
  "outputMode": "both",
  "csvFormat": "standard",
  "keepCpf": false,
  "includeAdditionalInfo": false,
  "deduplicate": true,
  "maxConcurrency": 4
}
```

## Output

```json
{
  "rowType": {
    "label": "Row type",
    "format": "text"
  },
  "status": {
    "label": "Status",
    "format": "text"
  },
  "sourceFile": {
    "label": "File",
    "format": "text"
  },
  "accessKey": {
    "label": "Chave de acesso",
    "format": "text"
  },
  "documentType": {
    "label": "Modelo",
    "format": "text"
  },
  "number": {
    "label": "Número",
    "format": "text"
  },
  "issuerName": {
    "label": "Emitente",
    "format": "text"
  },
  "totalInvoice": {
    "label": "Valor total NF",
    "format": "number"
  },
  "authorizationStatus": {
    "label": "Situação",
    "format": "text"
  },
  "cancelled": {
    "label": "Cancelada",
    "format": "boolean"
  },
  "errorMessage": {
    "label": "Error",
    "format": "text"
  },
  "charged": {
    "label": "Charged",
    "format": "boolean"
  }
}
```

## About this Actor

This example demonstrates how to use [NF-e XML Parser to Excel/CSV — Converter XML de Nota Fiscal](https://apify.com/brasil_utils/nfe-xml-parser.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/brasil_utils/nfe-xml-parser.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/brasil_utils/nfe-xml-parser.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
