I think this line alone without the range should output row 13, column 3:
{{ index ( index $csv $r ) $c }}
It starts with 0, so always add a -1 to the variables where you set the location of the cell.
Then remove the range part, because if you range inside of it the dot (.) is one row, so you could access the column by using {{ index . $c }}. But: you would access that column in EVERY row, so take away the range line and the end line and try again.
Thanks a lot! I removed the {{range}} part, and it output the right result with local csv file now.
but when I use the google spreadsheet csv url, console remind me the infomation below.
ERROR 2021/03/30 21:05:28 Failed to get CSV resource “https://docs.google.com/spreadsheets/d/1N8480w1hPyilUS4qK1rnSY6RiE-OX-2hy1glQCTRh_w/export?format=csv”: failed to parse CSV file https://docs.google.com/spreadsheets/d/1N8480w1hPyilUS4qK1rnSY6RiE-OX-2hy1glQCTRh_w/export?format=csv: parse error on line 3, column 11: bare " in non-quoted-field
If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config:
ignoreErrors = [“error-remote-getcsv”]
ERROR 2021/03/30 21:05:28 render of “page” failed: execute of template failed: template: _default/single.html:9:6: executing “main” at <index (index $csv 1) 1>: error calling index: index of untyped nil
ERROR 2021/03/30 21:05:28 render of “page” failed: execute of template failed: template: _default/single.html:9:6: executing “main” at <index (index $csv 1) 1>: error calling index: index of untyped nil
ERROR 2021/03/30 21:05:28 render of “page” failed: execute of template failed: template: _default/single.html:9:6: executing “main” at <index (index $csv 1) 1>: error calling index: index of untyped nil
ERROR 2021/03/30 21:05:28 render of “page” failed: execute of template failed: template: _default/single.html:9:6: executing “main” at <index (index $csv 1) 1>: error calling index: index of untyped nil
Built in 32175 ms
Error: Error building site: failed to render pages: render of “page” failed: execute of template failed: template: _default/single.html:9:6: executing “main” at <index (index $csv 1) 1>: error calling index: index of untyped nil
This is because you did not publish your spreadsheet properly. You need to set it to public because getCSV does not add any authentication to the file.