gspread中的col_count提供了列总数,即使它们没有数据 [英] col_count in gspread provides the total number of columns even though they have no data
本文介绍了gspread中的col_count提供了列总数,即使它们没有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在gspread中使用col_count时,即使只有三列包含数据,也包含行,我都会获得Google工作表的总列数.如果我可以获取包含数据的列和行数,则将更加有用.有没有办法做到这一点?
When I use col_count in gspread I get the total number of columns of the Google sheet, even though only three columns contain data, also with the rows. It would be more useful if I could get the number of columns and rows with data. Is there a way to do that?
推荐答案
对我来说,这似乎也是一个问题. 但是对我来说,这些效果很好
That's seems a problem for me also. But for me these works nicely
gc=gspread.authorize(cred)
sh=gc.open('test').sheet1
a=len(sh.row_values(1))
print('column count',end=' ')
print(a)
这篇关于gspread中的col_count提供了列总数,即使它们没有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文