I'm trying to save all descriptions from a nested data return. I can save the description of a single index on my fetch. When I try to do it anywhere outside of the fetch, I get the error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'c'). C is the final section of the nested results (data[1].c[1].v). I'm not sure exactly what I'm doing wrong. I can pass the info down to the jsx and display it, but I still need to loop through all the descriptions. Any tips would be helpful.
const jsonData = JSON.parse(data.substring(47).slice(0,-2));
setSpreadsheetData(jsonData.table.rows[1].c[1].v)
This is what returns the single description for the data. The first 1 index is what I need to loop through to get each result. Everything after is the exact path for the description. Any tips in the right direction would be helpful.