'How to prevent rows combining in pd.read_csv() google sheets

I'm seeing an odd behaviour where the first 5 rows in my google sheet are combining to one row in my dataframe.

This is the output from df.columns.values:

['business_name Sleap Eazy The Trustee 4 Eyes Stella Trading'
 'bn 92169399679 19632623411 71161425341 16149685099'
 'nmi 61021333386 53312704325 52600212142 QB078326211']

Even though the business_name is in the first row as a header its combining with the 4 cells below it. I also didn't have this behavior a few days ago, anyone know why?

URL = 'https://docs.google.com/spreadsheets/d/{0}/gviz/tq?tqx=out:csv&sheet={1}' \
      .format(googleSheetId, worksheetName)
df = pd.read_csv(URL, keep_default_na=False)


Solution 1:[1]

I had same issue where it was combining first 2 rows as header. Was not able to solve it with read_csv, but switched to gspread package to work around it.

import gspread
gc = gspread.service_account()
sh = gc.open('my sheets')
worksheet = sh.worksheet("sheet1")
df = pd.DataFrame(worksheet.get_all_records())

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jtebb