append_table(values, start='A1', end=None, dimension='ROWS',
overwrite=False)
Options | Details |
---|---|
values | Data List to be added |
start | Staring Point of top left cell ( 'A5') |
end | Bottom right cell |
dimension | The way the value will be added, (Default : ROWS) ,ROWS or COLUMNS( See the example below ). |
overwrite | If True the data will be overwritten |
import pygsheets
path='G:\\My drive\\testing\\google-sheet\\creds1.json'
gc=pygsheets.authorize(service_account_file=path)
sh=gc.open('my_gsheets1')
wk1=sh[0]
Adding one row of data
data1=['Jack',80,90]
wk1.append_table(data1,start='A3')
l1=[['Jack4',80,90],['Ron4',70,90],['Geek4',50,40]]
wk1.append_table(values=l1)
l1=[['Jack4',80,90],['Ron4',70,90],['Geek4',50,40]]
for data in l1:
wk1.append_table(data,start='A2', end=None,
dimension='ROWS', overwrite=False)
By using loop we can add conditions and change the data based on required logic. path="D:\\my_data\\student.csv" # sample CSV file, use your path
fob=open(path,)
#headings = next(fob) # removing header row
for rec in fob:
student=rec.split(',')
print(student)
wk1.append_table(start='A2',values=student)
import pandas as pd
path="D:\\my_data\\student.csv" # sample CSV file, use your path
df=pd.read_csv(path)
wk1.set_dataframe(df,(3,1))# Place DataFrame from row 3 column 1
import pandas as pd
path="D:\\my_data\\student.xlsx" # sample Excel file, use your path
df=pd.read_excel(path)
wk1.set_dataframe(df,(3,1)) # Place DataFrame from row 3 column 1
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.