简体   繁体   中英

Read excel file with an online Python compiler with xlrd

Me and my group are currently working on a school project where we need to use an online python compiler, since we are not allowed to install or download any software on their computers. The project requires me to read data from a .xlsx file.

Is there any online IDE with xlrd that can read the file that is on the school's computer?

I've been looking at a few but can't seem to find any that has this support. On tutorialspoint.com it is possible to upload the excel file but not import xlrd. Other sites has xlrd but doesn't allow for uploading files to the site.

You could look into Cloud9 for online IDE. It wouldn't have access to your computer's filesystem, but you could either:

  • Build a tiny flask web app that exposes a website with an upload form. You could upload your file through the form, and have the backend use xlrd to do whatever you need.
  • Straight up upload your file to your C9's workspace, via C9's interface itself.

You can most definitely install xlrd on C9.

  1. Could the pandas package and its pandas.read_clipboard function help? You'd need to copy the content of the file manually to the clipboard before starting your script.

  2. Alternatively - is it considered cheating to just rent a server? Pretty cheap these days.

  3. Finally: you don't usually require admin rights to install Python... so assuming it's not a violation of school policy, the Anaconda distribution for instance is very happy to be installed for the local user only.

import tabula

Read a PDF File

df = tabula.read_pdf("file:///C:/Users/tanej/Desktop/salary.pdf", pages='all')[0]

convert PDF into CSV

tabula.convert_into("file:///C:/Users/tanej/Desktop/salary.pdf", "file:///C:/Users/tanej/Desktop/salary.csv", output_format="csv", pages='all') print(df)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM