Spreadsheets
Check phone numbers, country codes and carriers in Google Sheets
Add a custom function to a sheet that checks a phone number against its numbering plan and fills the format and type columns beside it.
Why the data matters in Google Sheets
Phone columns in a shared sheet collect every spelling people can type: spaces, brackets, a missing country code. Dialers and mail merges read that column as is, so one mistyped row means a failed call and a manual hunt through hundreds of lines.
What LookValid checks
| Product | What it does here | Credits |
|---|---|---|
| Phone Numbering-Plan Validation | Returns the E.164 form, the national and international formats, the country and the number type from open numbering-plan data. It does not check that the line is active. | 1 credit per valid number |
| Country Calling Codes | Looks up a calling code or country name and returns the regions that share it and the national number lengths. | 1 credit per lookup (an unknown code, country or name is free) |
| Carrier Lookup (original carrier) | For US numbers, adds the carrier originally assigned the block and the state, with ported numbers still showing the original. | 1 credit per lookup (numbers outside the covered numbering plan areas are free) |
Connect it in four steps
- Create a LookValid account and an API key from the dashboard, which a person does once.
- Open the sheet's Apps Script editor and save the key as a script property named LOOKVALID_API_KEY, which PropertiesService.getScriptProperties reads back at run time, so the key is never typed into a cell.
- Call the function for each phone cell; it sends a POST through UrlFetchApp.fetch with the key in the Authorization header, and the first run asks you to approve the external request permission the script needs. A null return means found was false, so leave the row blank, and a thrown error carries the error code and fix for you to read.
- Write the E.164, line type, country and valid values into the columns beside the phone column, one row per number.
An Apps Script project bound to the spreadsheet, whose function calls UrlFetchApp.fetch for each phone cell, run from a menu item or a loop over the column. The call is POST https://YOUR_API_HOST/v1/phone and costs 1 credit per valid number.
var API_URL = "https://YOUR_API_HOST/v1/phone";
function validateSheetPhone(value) {
var key = PropertiesService.getScriptProperties().getProperty("LOOKVALID_API_KEY");
var response = UrlFetchApp.fetch(API_URL, {
method: "post",
contentType: "application/json",
headers: { Authorization: "Bearer " + key },
muteHttpExceptions: true,
payload: JSON.stringify({
"phone": value,
}),
});
var result = JSON.parse(response.getContentText());
if (response.getResponseCode() >= 400) throw new Error(result.error.code + ": " + result.error.fix);
if (!result.found) return null;
return {
"Phone (E.164)": result.data?.e164 === undefined ? null : result.data?.e164,
"Line type": result.data?.number_type === undefined ? null : result.data?.number_type,
"Country": result.data?.country === undefined ? null : result.data?.country,
"Valid": result.data?.valid === undefined ? null : result.data?.valid,
};
}
| Response field | Goes into |
|---|---|
| data.e164 | Phone (E.164) |
| data.number_type | Line type |
| data.country | Country |
| data.valid | Valid |
The recipe returns nothing when the lookup finds nothing, which costs no credits for this product, and stops with the error code and fix on a failed request.
Without code
You can also reach the same endpoint without writing script: an automation platform's generic HTTP request step can read each new row from the sheet, send the phone number to LookValid, and write the answer back into the adjacent columns. No dedicated LookValid app is involved, and nothing is added to the spreadsheet itself.
Questions
What does it cost in credits?
The pricing page lists the credits for the phone product. A sheet of 500 rows is 500 lookups, so run the function on new rows rather than the whole column each time.
What does the phone check not do?
It follows the numbering plan only. It cannot say whether a number is active, who holds it or whether it can receive a call.
Where does the key go?
In the script properties of the Apps Script project, read by the function through PropertiesService at run time.
Sources
- UrlFetchApp class reference (Apps Script) https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app, read 2026-10-18
- PropertiesService class reference (Apps Script) https://developers.google.com/apps-script/reference/properties/properties-service, read 2026-10-18
- LookValid API reference: Phone Numbering-Plan Validation https://lookvalid.com/docs/api/phone, read 2026-10-18
LookValid is run by Meralume Labs. It is not connected to, endorsed by or a partner of any company or product named on this page, and every product name belongs to its owner.
Related pages
LookValid bills every lookup in credits from one shared balance, so the same key works for each check above.
See Phone Numbering-Plan Validation