0

We have very strict rules on what can be installed and there is no way around them and legal repercussions it I could. I can't even install PIP, let alone run it.

If we accept that, is there any way to convert an Excel .xlsx file to csv?

Is there a DOS command line that I can run? DuckDuckGo doesn't seem to think so.

Is there a Python module that I can simply download, with having to use PIP? (preferably a single file, rather than a directory tree, as I will have to distribute it with my script))

Is there any other way?

Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • what about conda prompt? on anaconda.org you can install this applications in your enviorment... – PV8 Aug 15 '19 at 09:42
  • What would I have to do, and how would that help? Can you give some details, please? Feel free to post a detailed answer – Mawg says reinstate Monica Aug 15 '19 at 09:47
  • 2
    You can simply download any Python module. What you prevent you to do that? – Sraw Aug 15 '19 at 09:47
  • Then which module should I use, and how do I use it? If you wan to talk about downloading wheels or similar, please explain how to extract the module. I would welcome a detailed answer. – Mawg says reinstate Monica Aug 15 '19 at 09:49
  • pip is made of python modules. – Stop harming Monica Aug 15 '19 at 09:57
  • If your company policy prohibits you from using the needed external tools, why not just use the Excel functionality "Save As -> .csv"? For a guide, follow [this link](https://www.ablebits.com/office-addins-blog/2014/04/24/convert-excel-csv/). – Christopher Graf Aug 15 '19 at 10:01
  • 1
    get openxlsx as wheel, put the package in the script where you need it: no need to install anything if python is installed. Clarify which OS you're on btw – Jean-François Fabre Aug 15 '19 at 10:38
  • @ChrisGraf that's exactly what I am trying to automate. There are a lot of XLSX files, so we don't want to have to do it by hand. – Mawg says reinstate Monica Aug 15 '19 at 11:37
  • I will look into that, thanks (+1). I am open to a Windows or Linux solution, but maybe this is a solution. Feel free to post an answer – Mawg says reinstate Monica Aug 15 '19 at 11:41
  • 1
    @Mawg this solution might also not be possible due to company policies since you would need to be able to use `apt-get install gnumeric` (Linux). However, see [this answer](https://stackoverflow.com/a/10580741/3209393) in case it is possible. – Christopher Graf Aug 15 '19 at 13:18
  • 2
    @ChrisGraf Gnumeric can be downloaded as source code, built and deployed across the organization. Apparently the policies allow that. But doing it with a python package would be way easier. – Stop harming Monica Aug 15 '19 at 18:25

1 Answers1

0

here is a lot of solutions to convert from csv to xlsx. With examples of libs which you can install via PIP. You can get the high level idea how you can convert. Python convert csv to xlsx

Without libs (xlsxWriter, openpyxl etc) you shoud have deep understanding of xlsx file structure.

kore666
  • 1,501
  • 1
  • 11
  • 8
  • Looks goo. How do I download it as a stand-alone module, not a package to be installed? – Mawg says reinstate Monica Aug 15 '19 at 09:50
  • 1
    We are on interview? -) You can't use PIP, but you can ssh to some machine with python? It's not good solution - copy needed site-packages module from somewhere else. But it may have dependencies, it may linked with c++ modules installed on system which can be not compatible on destination machine – kore666 Aug 15 '19 at 09:56
  • No, we are not on the interview, we are on the "Here is an answer, not just a hint" ;-) If I have to figure something out, all future readers have to figure it. If you explain once, many will learn in future. Sorry, no SSH (great idea), it's "government", so almost nothing is enabled or allowed :-( – Mawg says reinstate Monica Aug 15 '19 at 11:40
  • 2
    @Mawg Both [openpyxl](https://bitbucket.org/openpyxl/openpyxl/src/default/openpyxl/) and [xlsxwriter](https://github.com/jmcnamara/XlsxWriter/tree/master/xlsxwriter) are packages containing several modules, as one should expect given the complexity of the task. But downloading a directory and moving it around is not much different from doing the same with a file. Also there is no point in forbidding you from using pip if you are allowed to download code from the Internet, that's exactly what pip would do for you. Looks like an attempt to circumvent the rules, make sure you are in the clear. – Stop harming Monica Aug 15 '19 at 15:57
  • Well, my boss, locally, will turn a blind and pragmatic eye, but the IT department with their scanners would be less forgiving. – Mawg says reinstate Monica Aug 16 '19 at 06:21