Using openpyxl to read file from memory

后端 未结 3 1242
情书的邮戳
情书的邮戳 2020-12-06 04:32

I downloaded a google-spreadsheet as an object in python.

How can I use openpyxl use the workbook without having it to save to disk first?

I know that xlrd c

3条回答
  •  半阙折子戏
    2020-12-06 04:34

    Actually enough is to:

    file = open('path/to/file.xlsx', 'rb')
    wb = openpyxl.load_workbook(filename=file)
    

    and it will work. No need for BytesIO and stuff.

提交回复
热议问题