[Python] How to change EXCEL file saved in xlsb to xlsx

What is this

For some reason, I saved the EXCEL file in the format of xlsb (and for 3 years!), And it wasn't read by BI tools in that format, so I had to change the format one by one by hand and save it. I was desperate, so I checked if it could be done with Python. I didn't have much information on Qiita, so I'll write it down.

Conclusion

With the Pyxlsb library, it's done.

script

import pandas as pd
import pyxlsb

import_file='sample.xlsb' #Location of read file
sheet= 'sheet1' #Sheet name of the read file
export_file='sample.xlsx' #File dump destination
df_read = pd.read_excel(import_file,sheet,engine='pyxlsb') #Read xlsb file
df_read.to_excel(export_file) #Save as xlsx

reference

[XLSB file to Pandas Python](https://www.it-swarm-ja.tech/ja/python/xlsb%E3%83%95%E3%82%A1%E3%82%A4%E3%83% AB% E3% 82% 92pandas-python / 833269674 /)

Recommended Posts

[Python] How to change EXCEL file saved in xlsb to xlsx
[Work efficiency] How to change file names in Python
How to read an Excel file (.xlsx) with Pandas [Python]
How to create a JSON file in Python
[Python] How to read excel file with pandas
How to change Python version
How to develop in Python
[Python] How to do PCA in Python
How to collect images in Python
Change the standard output destination to a file in Python
How to use SQLite in Python
How to import a file anywhere you like in Python
How to use Mysql in python
How to wrap C in Python
How to use PubChem in Python
[Python] How to output a pandas table to an excel file
How to handle Japanese in Python
Convert Excel file to text in Python for diff purposes
[Python] How to convert db file to csv
[Introduction to Python] How to use class in Python?
How to access environment variables in Python
How to dynamically define variables in Python
How to do R chartr () in Python
How to convert Python to an exe file
[Itertools.permutations] How to put permutations in Python
Convert psd file to png in Python
How to work with BigQuery in Python
How to get a stacktrace in python
How to display multiplication table in python
How to extract polygon area in Python
How to check opencv version in python
How to switch python versions in cloud9
How to adjust image contrast in Python
How to use __slots__ in Python class
How to use regular expressions in Python
How to display Hello world in python
How to change editor color in PyCharm
How to use is and == in Python
How to write Ruby to_s in Python
How to use the C library in Python
How to read a CSV file with Python 2/3
How to receive command line arguments in Python
[REAPER] How to play with Reascript in Python
How to clear tuples in a list (Python)
How to generate permutations in Python and C ++
How to embed a variable in a python string
How to implement Discord Slash Command in Python
[Python] How to change the date format (display format)
Summary of how to import files in Python 3
Import Excel file from Python (register to DB)
How to simplify restricted polynomial fit in python
How to implement shared memory in Python (mmap.mmap)
From file to graph drawing in Python. Elementary elementary
Summary of how to use MNIST in Python
[Python] Implemented automation in excel file copying work
How to specify TLS version in python requests
How to notify a Discord channel in Python
How to get the files in the [Python] folder
How to use tkinter with python in pyenv
How to run Leap Motion in non-Apple Python
[Python] How to draw a histogram in Matplotlib