0

I am new to learning python and it is an exciting language. I have successfully learned to import .csv file from an internet URL into my python. However, I am having no luck in doing so for an .xlsm (macro enabled excel file).

As an example, I need to import the following file: https://www.bocsar.nsw.gov.au/Documents/Datasets/RCI_offencebymonth.xlsm

This is located at: https://www.bocsar.nsw.gov.au/Pages/bocsar_datasets/Offence.aspx

I am wondering if someone can point me into the right direction of how to import this xlsm directly from the URL link into python (preferably as a pandas dataframe).

I would like to achieve this 'without downloading' the file into my PC and then importing the file into my python. Wondering if there is a way to do all this using a code so everytime I run a code, python grabs the xlsm file from the URL.

Thanks

avid-python-learner

Lin Yu
  • 1
  • Maybe here: https://stackoverflow.com/questions/23554808/how-to-extract-sheet-from-xlsm-and-save-it-as-csv-in-python – garagnoth Oct 02 '21 at 03:47
  • Thanks @garagnoth but this thread is about importing an .xlsm file form within the computer. But my query is regarding getting .xlsm directly from the internet URL. – Lin Yu Oct 05 '21 at 05:12
  • Hi Lin Yu, concept should be the same. You just need to supply the path to the xlsm file. To do that, maybe this can give you an idea https://stackoverflow.com/questions/46437357/open-an-excel-from-http-website-using-xlrd – garagnoth Oct 05 '21 at 06:07

0 Answers0