How to save chart?

I have created a bar_chart using altair. Now I would like to insert that chart to my excel file.
The best solution would be to avoid saving the chart locally and instead, create a temporary buffer using io.BytesIO to further insert the image, like on the XlsxWriter official documentation:

image_data = BytesIO(urlopen(url).read())

# Write the byte stream image to a cell. Note, the filename must be
# specified. In this case it will be read from url string.
worksheet.insert_image('B2', url, {'image_data': image_data})

Alternatively I would like to save the chart locally, and then insert it to the Excel spreadsheet.