I am trying to parse the columns and rows of the timetable and then have it in a CSV file to import it to my google calendar.
So I when I try to get the title of the columns for perhaps any data from the column it comes one under another (refer the pic below.)
[
the code for the above output can be found below.
const columnTitles = $('.spreadsheet .spreadsheet .columnTitles')
.each((i, element)=> {
const nameLabel = $(element).text().trimStart().trimEnd();
console.log(nameLabel );
})
Below is the screenshot of HTML Elements

What am I missing on here? and how can I have it as comma-separated-values?
If it's just one table, then it's simple:
var html_table = $('.spreadsheet .spreadsheet .columnTitles');
var table_header = html_table.find('td').map(function() {return $(this).text().trim();}).toArray();
console.log('table_header', table_header.join(', '));