1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

OpenPyxlの備忘録

Last updated at Posted at 2022-09-02

はじめに

使用しているもの

openpyxl 3.0.10

# 前提コード
import openpyxl

wb = openpyxl.Workbook()

注意

間違いやもっとこうした方がいい、みたいのがあるかも

内容

get_なんたらは基本使わない

調べるとよく出てくる、
wb.get_sheet_by_name('Sheet1')
なんかはもう古いみたい。
他にもなにやら新しくなっているものがあり、ちょいちょい怒られる。
以下新旧対照表

内容
シート名を指定する wb["Sheet1"] wb.get_sheet_by_name('Sheet1')
シートを消す wb.remove(worksheet=wb["Sheet1"]) wb.remove_sheet(wb.get_sheet_by_name('Sheet1'))
シート一覧の取得 wb.sheetnames wb.get_sheet_names()

おわりズイ₍₍ (ง ˘ω˘ )ว ⁾⁾ズイ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?