IP Geolocation can be performed for both IPv4 and IPv6 addresses. This API can be used to match an IP address with a zip code, country region city, latitude longitude, or other data point. IP Geolocation is typically performed using an API (Application Programming Interface). This process can be used to determine the country, region, city, latitude, longitude, and other information associated with an IP address. Once the file is copied on your Drive, you can use it whenever you want.IP Geolocation is the process of mapping an IP address to a physical location. To enable editing, go to File → Make a copy. Note that the file is in the View only mode. The above functions are included in this sample Google Sheets file. For more detailed information (e.g., city or lat/long), the accuracy drops to even below 50% in some cases. The accuracy is quite high (probably higher than 95% or even 98%). The accuracy of IP geolocation depends on the information you are seeking. Therefore, I have added the necessary description in the parameters and an example, following the approach that was analyzed here. The getIpGeolocationData function will be used directly in the spreadsheet (check the image above). Performs the request and converts the response into JSON.Ĭhecks if the input string is blank, null or undefined. Return the location-related data to the sheet. LocationData = ipData + ', ' + ipData + ', ' + ipData Default case: get a combination of city, region, and country. Return the appropriate data based on the returnType parameter. Declaring the variable that will contain the returned location data. In case of error, return an error message. IpData = isBlank(ip)? getResponseJsonData('') : getResponseJsonData('' + ip) If the IP is empty, the IP of the Google Server storing the spreadsheet will be used. Send the request to the server and return the JSON data. Declaring the variable that will contain the JSON data returned from the request. Gets the location-related data based on the given IP and the return type. * getIpGeolocationData(ip = '', returnType = '') * The location-related data based on the given IP and the return type. null or empty string), a combination of city, region, and country will be returned. * Available options: "GEO", "TIME", "CITY", "ZIP", "REGION", "COUNTRY". * returnType A cell or a string value that has the type of data that will be returned. * This function returns location-related data based on an IP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |