The d3.tsv() function is used to read “.tsv” file or file with “tab” character as a delimiter. In the function if “init” is specified then it will fetch and go through the given function call.
Syntax:
d3.tsv(input[, init][, row])
Parameters: This function accepts three parameters as mentioned above and described below.
- inputFile: This parameter take the input file address.
 - init: This parameter accepts a function call.
 - row: This parameter accepts a optional row conversion function.
 
Example 1:
HTML
<!DOCTYPE html> <html lang="en">   <head>     <meta charset="UTF-8" />     <meta name="viewport" path1tent=         "width=device-width,           initial-scale=1.0" />               <script src=     </script> </head>   <body>     <script>         // Data of sample.tsv file         // year    population         // 2010    3         // 2011    45         // 2009    68         // 2010    5         // 2014    59         // 2011    55         // 2005    5         d3.tsv("sample.tsv", function (d) {             console.log(d);         });     </script> </body>   </html>  | 
Note: Please create a file name “sample.tsv” and save it in the working folder before going through the code.
Output:
Example 2:
HTML
<!DOCTYPE html> <html lang="en">   <head>     <meta charset="UTF-8" />     <meta name="viewport" path1tent=         "width=device-width,           initial-scale=1.0" />       <script src=     </script> </head>   <body>     <script>         // Data of sample.tsv file         // x    y         // 15    9         // 5    0         // 3    10         // 6    51         // 35    11         d3.tsv("sample.tsv", function (d) {             return d;         }, (d) => {             d.forEach((e) => {                 console.log(e)             })         });     </script> </body>   </html>  | 
Output:

                                    