1
1

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 3 years have passed since last update.

ドラッグアンドドロップでxlsファイルを読み込む

Posted at
ddExcel.py
import pandas as pd
import os
import io
import sys

def MojibakeTaisaku():
    # 出力の文字化け対策
    sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
    sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')


def main(wbName):
    MojibakeTaisaku()
    print(pd.__version__)

    # pyファイルのあるフォルダに移動する
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    df = pd.read_excel(wbName, index_col=0)
    print(df)

if __name__ == '__main__':
    # ドラッグアンドドロップでxlsファイルを読み込む
    wbName = sys.argv[1]
    main(wbName)
    input() # ターミナルが勝手に閉じるの防止用 何か入力すれば閉じる


1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?