Import CNPJs from Excel, CSV or text
How to import CNPJs from Excel spreadsheets, CSV or text files on CNPJá, with accepted separators, leading zeros, alphanumeric CNPJs and duplicates.
The CNPJs field reads the CNPJs you type, paste or load from an Excel (.xlsx), CSV or text file, and only the valid CNPJs move on. It appears in the CNPJ app, in Bulk lookup and in the Create a list and Add CNPJs dialogs, and works the same way in all three.
Where the field appears
| Where | How to get there | What happens to the CNPJs |
|---|---|---|
| Bulk lookup | CNPJ > Bulk lookup, CNPJs step | They become a new list, exported to a spreadsheet, as Bulk CNPJ lookup explains |
| Create a list | CNPJ > Lists > View all > Create list, or the + next to Lists in the sidebar | They make up a new list, as Create and manage lists explains |
| Add CNPJs | A list’s page > Add CNPJs | They go into the open list |
In the bulk lookup, anyone can fill in the field, but sending it takes membership in an organization, as does anything that creates or changes lists.
Type or paste
Type or paste the CNPJs in the field, one per line or separated by spaces, tabs, commas or semicolons, in any mix. That is why pasting a column or a row copied from a spreadsheet works as is.
- Punctuation: write them with or without dots, slash and hyphen. Quotes around a value are ignored too.
- Letters: an alphanumeric CNPJ can be written in upper or lower case.
- Other values: names, addresses, phone numbers and CPFs in the middle of the text do no harm. The field only picks up what is shaped like a CNPJ.
These values read as three CNPJs:
98.765.432/0001-98
03333333000120; EX.EMP.LO0/0001-54 Lines are numbered in the left margin, so you can find a value with a problem.
Upload a file
- Click Load file, to the right of the CNPJs label, or drag the file into the field until Drop to read the CNPJs appears.
- Choose a .xlsx, .csv or .txt file.
- Check the CNPJs found, which take the place of the field’s text, with the file name next to Load file.
While the file is read, the button shows Reading file…. The format is told by the extension of the file name:
| Format | How it is read |
|---|---|
| Excel (.xlsx) | The values of every cell, in every worksheet |
| CSV (.csv) | As text, with the same separators accepted when pasting |
| Text (.txt) | As text, the same as pasting |
Spreadsheets in the old Excel format (.xls), LibreOffice files (.ods) and PDF files are not accepted. Open the file in the program it came from and save a copy as .xlsx or CSV.
Important: loading a file replaces everything in the field. To combine CNPJs from several files, create the list with the first one and use Add CNPJs for the rest.
How the file is read
The file is read in your browser, and is not sent to CNPJá as a file. To create or change the list and, in the bulk lookup, also to work out the quota estimate, the app sends only the valid CNPJs found. Names, addresses, phone numbers, invalid CNPJs and the spreadsheet’s other columns do not go into the list. The same goes for typed or pasted text.
Valid, invalid and duplicates
The field marks every value it recognizes as a CNPJ:
| Mark | Meaning | When sent |
|---|---|---|
| Teal background | Valid CNPJ | Goes through, once |
| Amber background | A value shaped like a CNPJ whose check digits do not match | Left out |
| Struck through | A repeat of a valid CNPJ written earlier | Counts once |
| No mark | Some other value, such as a name, a phone number or a CPF | Left out |
Valid means well formed: 14 characters, the first 12 letters or digits, the last 2 digits, and matching check digits, as Alphanumeric CNPJ explains. The field does not check whether the CNPJ exists at the Receita Federal.
Under the field, a line counts the valid CNPJs against the list limit, the invalid ones (One invalid CNPJ will be ignored., for instance) and the repeats, each count beside a swatch of its mark. The count of valid CNPJs turns red once it goes past the limit.
Keep only the CNPJs
When the text holds other values besides CNPJs, such as a pasted spreadsheet with names and addresses, Keep only the CNPJs appears at the end of the count line.
- Paste the text or load the file.
- Click Keep only the CNPJs.
- Fix or delete the invalid CNPJs, which sit at the top of the field.
The field is rewritten with the invalid ones first and then each valid CNPJ once, with punctuation, one per line. Undo brings back the original text, as long as you type nothing else. The step is optional: values that are not CNPJs are already left out when sending. A loaded file already fills the field with the CNPJs alone.
Leading zeros and Excel
When the column is not formatted as text, Excel treats the CNPJ as a number and drops its leading zeros: 03.333.333/0001-20 becomes 3333333000120. The field puts those zeros back on its own: a number of 12 or 13 digits gets its missing zeros when the check digits confirm the CNPJ.
Digits lost any other way do not come back. That is the case of a CSV saved with the CNPJ in scientific notation, such as 9.87654E+13: the value gets no mark. In those cases:
- load the .xlsx spreadsheet itself instead of a CSV exported from it;
- or format the CNPJ column as Text in Excel before saving the CSV.
Limits
The field takes up to the CNPJ limit of a list, counting valid CNPJs without repeats; the current value is in Usage limits.
Common problems
- Load an Excel (.xlsx), CSV or text file. The file has another extension, such as .xls, .ods or .pdf. Save a copy as .xlsx or CSV and load it again.
- No CNPJ found in this file. No value in the file is shaped like a CNPJ. Check that the file holds the CNPJ column and that the numbers did not turn into scientific notation.
- We couldn’t read this file. The file may be damaged or password protected. Open it, save a copy without a password as .xlsx or CSV and load the copy.
- Add at least one valid CNPJ. No value in the field is a valid CNPJ. Check the amber values.
- A list holds up to 1,000,000 CNPJs. There are more valid CNPJs than a list takes. Split them into more than one list.
- A CNPJ turned amber. The check digits do not match: a digit is swapped or missing, or Excel lost digits. Fix the value or leave it out, since it is not sent.
- A CNPJ got no mark. The field did not recognize it as a CNPJ, for instance because it has spaces in the middle or fewer than 12 digits. Write the whole CNPJ, without spaces.
- Repeats are no longer struck through. In very long texts, the field stops striking through and counting repeats, but the count of valid CNPJs stays right and each CNPJ goes through only once.
- A line got no marks at all. Very long lines get no marks, but their CNPJs are read and counted as usual in the line under the field.