Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
xlrd を使用すると、最後の列が何であるかを簡単に知ることができます。
win32com を使用する簡単な方法はありますか?
ws.UsedRange.Rows.Count を使用してみましたが、正しい答えが得られないようです。
これは、使用されている範囲内の行数を示すように定義されています( cell から始まらない場合があります)。ワークシートの列数が必要です。A1
A1
次のようなことを試してください:
used = ws.UsedRange nrows = used.Row + used.Rows.Count - 1 ncols = used.Column + used.Columns.Count - 1