# Exported spreadsheet format

> The worksheets and columns of the XLSX file CNPJá exports, how it splits into parts, how columns map to the API and how to open it in Excel or Google Sheets.

The spreadsheet of an export or a bulk lookup is an XLSX file with one worksheet for the registration of the establishments in the list and one worksheet for each set of items: the activities, the partners and, depending on the resources chosen for the export, the tax regime history and the registrations. It is downloaded on the list's page, under **Exports**, as [Export to a spreadsheet](https://cnpja.com/en-us/docs/lists/export#download) explains.

## File and parts

| Item | What it is |
| --- | --- |
| Format | XLSX, Excel's format, the only one offered |
| File name | The list's name at the time of the download, such as `Clientes.xlsx`. Slashes in the name become hyphens |
| Name of each part | The list's name, the part number and the number of parts: `Clientes (1-3).xlsx`, `Clientes (2-3).xlsx` and `Clientes (3-3).xlsx` |

The export is split into parts when some worksheet would go past the maximum rows per worksheet, which is in [Usage limits](https://cnpja.com/en-us/docs/billing/limits#lists). In practice, the worksheets that reach that maximum are the ones with several rows per establishment, such as Activities and Partners.

Each part is a complete spreadsheet, with every worksheet, the title band and the header, and holds a slice of the list's establishments. Each establishment sits whole in a single part, with its activities, partners and registrations. Parts are downloaded separately, and only all of them together hold the whole list.

## Worksheets

The worksheet and column names below are those of a file in English. A file in Portuguese has them, and the values CNPJá writes, in Portuguese, as [In the spreadsheet](https://cnpja.com/en-us/docs/data/format#spreadsheet) explains.

| Worksheet | When it appears | One row per |
| --- | --- | --- |
| Establishments | Always | Establishment in the list |
| Activities | Always | Economic activity of the establishment: the primary one and each secondary one |
| Partners | Always | Partner or administrator of the establishment's company |
| Tax Regime Timeline | With **Tax regime** at the **Detailed** level | Previous period or upcoming event of the company's tax regime |
| State Registrations | With **State registrations** | State registration of the establishment in the states queried |
| SUFRAMA Registrations | With **SUFRAMA registrations** | Registration of the establishment at SUFRAMA |

Every worksheet follows the same layout:

- **Band and header:** the first row holds the CNPJá logo and the worksheet's title, and the second the column names, with filters.
- **Link between worksheets:** every worksheet starts with the establishment's CNPJ and Legal Name columns, which tie each item to its row in Establishments, and ends with Updated Date.
- **Frozen panes:** the band, the header and the CNPJ and Legal Name columns stay visible as you scroll.

An establishment with no items for a worksheet, such as one with no partners, simply has no rows in it. A company's partners repeat for each of its establishments in the list.

## Establishments worksheet

The columns, in order. Those marked with a resource only appear when it is chosen for the export, and the last column gives the matching field in the [CNPJ lookup](https://cnpja.com/en-us/docs/api/cnpj-lookup) response:

| Column | What it holds | API field |
| --- | --- | --- |
| CNPJ | The establishment's CNPJ | `taxId` |
| Legal Name | The company's legal name | `company.legalName` |
| Trade Name | The establishment's trade name | `tradeName` |
| Type | Head office or branch | `type.label` |
| Incorporation Date | The establishment's incorporation date | `incorporationDate` |
| Registration Status | The registration status | `status.label` |
| Status Date | The date of the registration status | `statusDate` |
| Status Reason | The reason, when the establishment is not active | `statusReason.label` |
| Special Status | The special status, when there is one | `specialStatus.label` |
| Special Status Date | The date of the special status | `specialStatusDate` |
| Company Size | The company's size | `company.size.label` |
| Share Capital | The company's share capital | `company.shareCapital` |
| Legal Nature Code | The legal nature code | `company.legalNature.code` |
| Legal Nature | The legal nature description | `company.legalNature.label` |
| Responsible Federative Entity | The federative entity, in public administration | `company.federativeEntity.label` |
| Tax Regime | With **Tax regime**: the regime type | `company.taxRegime.type.label` |
| Simples Nacional Start Date | With **Tax regime**: the start of the current Simples Nacional period | `company.taxRegime.simplesNacionalStartDate` |
| SIMEI Start Date | With **Tax regime**: the start of the current SIMEI period | `company.taxRegime.simeiStartDate` |
| IBS Regular Regime Start Date | With **Tax regime** at the **Detailed** level: the start in the IBS regular regime | `company.taxRegime.regularIbsStartDate` |
| CBS Regular Regime Start Date | With **Tax regime** at the **Detailed** level: the start in the CBS regular regime | `company.taxRegime.regularCbsStartDate` |
| Primary Activity Code | The CNAE code of the primary activity | `primaryActivity.code` |
| Primary Activity | The description of the primary activity | `primaryActivity.label` |
| Street | The street of the address | `address.street` |
| Number | The address number | `address.number` |
| Complement | The address details | `address.details` |
| District | The district | `address.district` |
| City | The municipality name | `address.city` |
| State | The state abbreviation | `address.state` |
| Postal Code | The CEP | `address.postalCode` |
| Municipality Code (IBGE) | The municipality's IBGE code | `address.municipality` |
| Country | The country | `address.country.label` |
| Latitude | With **Address coordinates**: the latitude | `address.coordinates.latitude` |
| Longitude | With **Address coordinates**: the longitude | `address.coordinates.longitude` |
| Precision | With **Address coordinates**: Address, District or Municipality, as [Precision](https://cnpja.com/en-us/docs/data/location#precision) explains | `address.coordinates.precision` |
| Primary Phone | The first phone number | `phones[0].number` |
| Alternate Phone | The second phone number | `phones[1].number` |
| Email | Every email address, separated by commas in a single cell | `emails[].address` |
| Interstate Restrictions (Issuer → Recipient) | With **State registrations**: the interstate e-invoice restrictions, each written as the issuer's state, an arrow and the recipient's state, separated by commas | `stateRegistry.taxRestrictions` |
| Updated Date | The registration's last update from the Receita Federal | `updatedAt` |

What each piece of data means is covered in the Data section, starting with [Data formats](https://cnpja.com/en-us/docs/data/format).

## Item worksheets

In the worksheets below, the CNPJ and Legal Name columns are the same as in Establishments and are left out of the tables. The API fields are relative to each worksheet's item.

### Activities

One row for the primary activity and one for each secondary activity, from `primaryActivity` and `secondaryActivities`.

| Column | What it holds | API field |
| --- | --- | --- |
| Type | Primary or Secondary | `primaryActivity` or `secondaryActivities` |
| Code | The CNAE code | `code` |
| Description | The activity's description | `label` |
| Updated Date | The same as in Establishments | `updatedAt` |

### Partners

One row per partner or administrator, from `company.partners`. The worksheet holds personal data, whose use follows [Responsible use](https://cnpja.com/en-us/docs/data/partners-and-qsa#responsible-use).

| Column | What it holds | API field |
| --- | --- | --- |
| Name | The partner's name | `person.legalName` |
| Type | The person type | `person.type.label` |
| CPF/CNPJ | The CNPJ of a partner company or the [masked CPF](https://cnpja.com/en-us/docs/data/partners-and-qsa#masked-cpf) of a person | `person.taxId` |
| Age Group | The age group of an individual | `person.ageGroup` |
| Country | The country of domicile | `person.domicileCountry.label` |
| Admission Date | The date the partner joined | `admissionDate` |
| Role | The partner's role | `role.label` |
| Legal Representative | The legal representative's name, when there is one | `legalRepresentative.person.legalName` |
| Legal Representative CPF | The legal representative's masked CPF | `legalRepresentative.person.taxId` |
| Legal Representative Role | The legal representative's role | `legalRepresentative.role.label` |
| Updated Date | The same as in Establishments | `updatedAt` |

### Tax Regime Timeline

Only with **Tax regime** at the **Detailed** level: one row per previous period or upcoming event, from `company.taxRegime.timeline`, as [Tax regime](https://cnpja.com/en-us/docs/data/tax-regime) explains.

| Column | What it holds | API field |
| --- | --- | --- |
| Type | The type of the period or event | `type.label` |
| Start Date | The start | `startDate` |
| End Date | The end | `endDate` |
| Details | The detail of the period or event, such as the reason for an exclusion | `details` |
| Updated Date | The tax regime's last update, not the registration's | `company.taxRegime.updatedAt` |

### State Registrations

Only with **State registrations**: one row per registration in the states queried, from `stateRegistry.registrations`, as [State registration and CCC](https://cnpja.com/en-us/docs/data/state-registrations) explains.

| Column | What it holds | API field |
| --- | --- | --- |
| State Registration | The registration number | `number` |
| Registration State | The registration's state | `state` |
| Status | Enabled or Not Enabled | `isEnabled` |
| Type | The registration type | `type.label` |
| Status Date | The date of the status | `statusDate` |
| Recipient Restriction | Blocked, when there is a restriction | `hasRestriction` |
| Sublimit | At the **Detailed** level: Exceeded, when the sublimit was exceeded | `hasExceededSublimit` |
| Authorized Tax Documents | At the **Detailed** level: the authorized tax documents, separated by commas | `authorizedTaxDocuments[].label` |
| Activity Start Date | At the **Detailed** level: the start of activities in the state | `activityStartDate` |
| Activity End Date | At the **Detailed** level: the end of activities in the state | `activityEndDate` |
| Primary Activity Code and Primary Activity | At the **Detailed** level: the activity recorded in the registration | `primaryActivity` |
| Street to Country | At the **Detailed** level: the nine address columns, as in Establishments, with the registration's address | `address` |
| Updated Date | The registration's last update | `updatedAt` |

### SUFRAMA Registrations

Only with **SUFRAMA registrations**: one row per registration, from `suframa.registrations`.

| Column | What it holds | API field |
| --- | --- | --- |
| SUFRAMA Registration | The registration number | `number` |
| Registration Date | The registration date | `registrationDate` |
| Status | The registration's status | `status.label` |
| Approved Project | Whether the project was approved, as Yes or No | `hasApprovedProject` |
| Approval Date | The project's approval date | `approvalDate` |
| Primary Activity Code and Primary Activity | The activity recorded in the registration | `primaryActivity` |
| Street to Country | The nine address columns, with the registration's address | `address` |
| Primary Phone, Alternate Phone and Email | The registration's contacts, as in Establishments | `phones`, `emails` |
| Updated Date | The registration's last update | `updatedAt` |

## How values are written

How each value appears in the cells, from identifiers and dates to the share capital and missing values, which language the worksheets, columns and labels come in and what to watch for when using those values in formulas are in [In the spreadsheet](https://cnpja.com/en-us/docs/data/format#spreadsheet), on the Data formats page.

## Open in Excel and Google Sheets

- **Excel:** open the downloaded file with a double click. Avoid saving the spreadsheet as CSV and reopening it with a double click: Excel reads again as a number whatever has digits only, such as registration numbers, and drops the leading zeros.
- **Google Sheets:** upload the file to Google Drive and open it with Google Sheets, or use *File* > *Import* in an open spreadsheet. Google Sheets has a cell limit per file, and a very large export may not fit; in that case, use Excel.
- **Back to CNPJá:** the **CNPJs** field reads every worksheet of an .xlsx file, and the CPF/CNPJ column of Partners holds the CNPJs of partner companies, which would go into the list too. To bring only the establishments, copy the CNPJ column of Establishments and paste it into the field, as [Import CNPJs](https://cnpja.com/en-us/docs/lists/import#leading-zeros) explains.

## In the API

The export reads each establishment with the same options as [CNPJ lookup](https://cnpja.com/en-us/docs/api/cnpj-lookup): the additional resources, the detail levels, the states and the max age. In the API, the response is JSON and comes one CNPJ per request; in the spreadsheet, the whole list comes in one file or in parts, with the fields laid out in the columns above.

The API response also carries what the spreadsheet leaves out:

- the `code` of classified values, such as `status`, `company.size` and `role`, except for the legal nature and the activities;
- the type of each phone number and email address, in `type`, and the phone numbers from the third one on;
- the CNPJ root, in `company.id`, and each person's identifier, in `person.id`;
- the last query of each registration source, in `stateRegistry.updatedAt` and `suframa.updatedAt`, since the spreadsheet carries each registration's update;
- the tax regime's last update, in `company.taxRegime.updatedAt`, which only appears in Tax Regime Timeline.
