16 votes

Inexperienced Programming Question

TLDR: What programming language would be useful for taking info in an excel file and producing a text file (that is organized and arranged in a particular way) containing that info? Which would be useful for this problem but also helpful in general? And also, are there any recommended online courses where I could learn it?


I have no real experience coding or anything but have always wanted to learn. Recently at work we've encountered a problem. My boss had created a matlab program in order to take text/numbers from an excel document and transfer them to a text file, but in an organized way.

Say you have something you call "Pancakes" and the cell next to it has the number "3", as in there are three pancakes. I want to be able to create a text file that would read something like this:

NUMBER OF PANCAKES

  • Pancakes: 3

We recently have changed around the format of the excel document for a different item, for example "French Toast". I've tried to mess with matlab briefly but was unable to change the program to compensate, and I no longer easily have access to matlab.

I'm seeing this as an opportunity to learn some programming and also fix some stuff at work. So what programming language would be useful for fixing this problem? Which would be useful for this problem, but also helpful in general? And also, are there any recommended online courses where I could learn it?

Thanks for any help, I appreciate it.

28 comments

  1. [7]
    Celeo
    Link
    Any would work. If you're looking for a simple approach, Python is likely your best bet. If you have questions, feel free to ask. This comment from today has some resources; there should be a ton...

    Any would work. If you're looking for a simple approach, Python is likely your best bet. If you have questions, feel free to ask. This comment from today has some resources; there should be a ton of resources to learn Python.

    16 votes
    1. [4]
      what
      (edited )
      Link Parent
      I'd also highly recommend Python, it's become my go-to for writing quick scripts and simple tools. I'd suggest Codecademy to learn the basics, and from there, you'll pretty much just search/read...

      I'd also highly recommend Python, it's become my go-to for writing quick scripts and simple tools.

      I'd suggest Codecademy to learn the basics, and from there, you'll pretty much just search/read the docs for those little bits of functionality. For example, you're parsing Excel files, and luckily, Python has a built in CSV library! You could search for basic usage of the library, or read the documentation itself. Once you have a bit of experience, you can throw together stuff to make one-off scripts very quickly with Python.

      Good luck!

      Edit: should also add, aside from simple tools like these, Python lets you do pretty much anything else as well - desktop software, games, even websites (like Tildes), so it's a very good investment of your learning.

      6 votes
      1. [3]
        jawa413
        Link Parent
        Thanks, I did want a program that would help me beyond just this task so python sounds like a great choice

        Thanks, I did want a program that would help me beyond just this task so python sounds like a great choice

        2 votes
        1. [2]
          ali
          Link Parent
          The most important thing is to just start and keep going. People will recommend tons of different things. I personally loved 'automate the boring stuff with python' as a source, the excel chapter...

          The most important thing is to just start and keep going. People will recommend tons of different things. I personally loved 'automate the boring stuff with python' as a source, the excel chapter will be helpful for you once you understood the basics

          3 votes
          1. jawa413
            Link Parent
            Thanks, a few others recommended "Automate..." So clearly I need to check it out

            Thanks, a few others recommended "Automate..." So clearly I need to check it out

            1 vote
    2. Emerald_Knight
      Link Parent
      I just wanted to echo that Python is an ideal first language for getting started quickly. You don't have to worry about type juggling, you don't need to go through a complicated setup process, you...

      I just wanted to echo that Python is an ideal first language for getting started quickly. You don't have to worry about type juggling, you don't need to go through a complicated setup process, you don't need to learn how to compile a program, you don't need to navigate a command line, it's incredibly flexible, and it can do a lot of useful stuff out of the box. It's also popular enough that there are countless tutorials available to show you how to accomplish a task.

      Whenever someone wants to learn about programming on their own, Python is always my first recommendation :)

      3 votes
    3. jawa413
      Link Parent
      Great, that post actually reminded me to ask the question. Thanks a lot, I'll give it a shot.

      Great, that post actually reminded me to ask the question. Thanks a lot, I'll give it a shot.

      1 vote
  2. [5]
    Deimos
    (edited )
    Link
    I'd suggest trying out the (free) book Automate the Boring Stuff with Python: https://automatetheboringstuff.com/ It seems to be well-regarded, and it's basically intended as a way to learn...

    I'd suggest trying out the (free) book Automate the Boring Stuff with Python: https://automatetheboringstuff.com/

    It seems to be well-regarded, and it's basically intended as a way to learn programming by applying it to tasks exactly like what you're describing. Chapter 12 is even specifically about working with Excel files.

    9 votes
    1. ali
      Link Parent
      He also has a video tutorial on udemy and I think there is a 50 percent off thing floating around on reddit for his course. But I think udemy in general always has sales for 10 dollars.

      He also has a video tutorial on udemy and I think there is a 50 percent off thing floating around on reddit for his course. But I think udemy in general always has sales for 10 dollars.

      2 votes
    2. balooga
      Link Parent
      Woah, thanks for the link! I've been meaning to dip my toe into Python and that might just be the resource I need to do it.

      Woah, thanks for the link! I've been meaning to dip my toe into Python and that might just be the resource I need to do it.

      1 vote
    3. [2]
      jawa413
      Link Parent
      Thanks, this was recommended by a few others. Definitely seems like what I'll want once I get the basics down

      Thanks, this was recommended by a few others. Definitely seems like what I'll want once I get the basics down

      1 vote
      1. Deimos
        Link Parent
        Oh, it should teach you the basics. It says "Practical programming for total beginners" and "no prior programming experience required".

        Oh, it should teach you the basics. It says "Practical programming for total beginners" and "no prior programming experience required".

        2 votes
  3. [2]
    nonesuchluck
    Link
    Python is great. You can find any number of free language classes, but if you're like me and like to learn by doing, just go download Anaconda for Python 3 and lookup Excel tutorials like this...

    Python is great. You can find any number of free language classes, but if you're like me and like to learn by doing, just go download Anaconda for Python 3 and lookup Excel tutorials like this one. There's tons of sample code all over the internet, just google anything you don't understand and start changing the code until it does something interesting. Any common package you're likely to need such as xlrd will already be bundled with Anaconda, so just ignore any talk about pip or virtual environments until you're more comfortable.

    6 votes
    1. jawa413
      Link Parent
      Thanks, I'll definitely take a look. I'm also a hands-on person so jumping right might be good

      Thanks, I'll definitely take a look. I'm also a hands-on person so jumping right might be good

  4. [5]
    ourari
    Link
    Just bumped into this by chance. Could be useful to you: https://realpython.com/python-csv/

    Just bumped into this by chance. Could be useful to you:

    https://realpython.com/python-csv/

    4 votes
    1. [3]
      666
      Link Parent
      Since OP is talking about Excel he may be interested in pyexcel if he can't or doesn't want to export the Excel data to csv. I've used it and it's pretty simple. The README.rst file has a lot of...

      Since OP is talking about Excel he may be interested in pyexcel if he can't or doesn't want to export the Excel data to csv. I've used it and it's pretty simple. The README.rst file has a lot of useful and simple examples that OP can copy & paste and modify to his needs.

      6 votes
      1. [2]
        onyxleopard
        Link Parent
        Another option is openpyxl. That’s my go-to module for parsing .xlsx workbooks.

        Another option is openpyxl. That’s my go-to module for parsing .xlsx workbooks.

        5 votes
        1. 666
          Link Parent
          That one is actually more powerful and is the one used by pyexcel as stated here. Pyexcel is just a simplified wrapper around openpyxl, I thought OP may prefer it because he said he's inexperienced.

          That one is actually more powerful and is the one used by pyexcel as stated here. Pyexcel is just a simplified wrapper around openpyxl, I thought OP may prefer it because he said he's inexperienced.

          6 votes
    2. jawa413
      Link Parent
      Thanks! This looks very useful

      Thanks! This looks very useful

      1 vote
  5. [3]
    Comment deleted by author
    Link
    1. jawa413
      Link Parent
      Yeah I'd imagine I could make any language work, but judging by responses and just to start out, python seems to play the most nicely. Thanks for breaking down the languages into their practical...

      Yeah I'd imagine I could make any language work, but judging by responses and just to start out, python seems to play the most nicely.
      Thanks for breaking down the languages into their practical purposes though, that helps. So far, python definitely seems to be the most useful for me now, both for this task and in general.

      2 votes
    2. Celeo
      Link Parent
      Which distros don't come with Python preinstalled?

      Which distros don't come with Python preinstalled?

      1 vote
  6. [3]
    super_james
    Link
    How complex is this existing program? Does it work well, how much MATLAB expertise can you draw on (from yourself and others). If it's just about trouble with MATLAB licenses my first thought...

    How complex is this existing program? Does it work well, how much MATLAB expertise can you draw on (from yourself and others).

    If it's just about trouble with MATLAB licenses my first thought would be to see if your existing program can run in GNU Octave. It isn't a complete Matlab replacement (some missing functions). But if you're just converting a spreadsheet to text it may well do the job.

    2 votes
    1. [2]
      jawa413
      Link Parent
      I basically have 0 experience with Matlab besides messing around, and the issue is with licenses as the company is a startup with limited resources. I'll have to look into GNU octave, it sounds...

      I basically have 0 experience with Matlab besides messing around, and the issue is with licenses as the company is a startup with limited resources.
      I'll have to look into GNU octave, it sounds interesting

      1. super_james
        Link Parent
        From a least effort perspective switching to Octave could be the way to go, I'd agree that future productivity wise your best bet is Python.

        From a least effort perspective switching to Octave could be the way to go, I'd agree that future productivity wise your best bet is Python.

        1 vote
  7. BossHogg2020
    Link
    Whenever I hear "text file", "text processing", "text manipulation", I am tempted to answer Perl! because that's right where it shines. However, in this case, your need for processing/manipulation...

    Whenever I hear "text file", "text processing", "text manipulation", I am tempted to answer Perl! because that's right where it shines.

    However, in this case, your need for processing/manipulation seems super basic, so a lot of languages match the need, and I'd answer: any language which has a good reliable library to read Excel files (to save the small pain of exporting to CSV). And since you have no coding experience, I will not try to recommend against the most common given proposition (Python) :-)

    2 votes
  8. [2]
    Grendel
    Link
    I would highly recommend the book "Automate the boring stuff with python". Its available for free under creative commons and is designed to teach complete beginners exactly the things that you are...

    I would highly recommend the book
    "Automate the boring stuff with python".
    Its available for free under creative commons and is designed to teach complete beginners exactly the things that you are wanting to learn.

    1 vote
    1. jawa413
      Link Parent
      I'll definitely have to check it out then, free is always good

      I'll definitely have to check it out then, free is always good

      1 vote
  9. soc
    Link
    Definitely Python - it does really well with file IO and string manipulation. An excel file should be a wrapper for a generic XML file of some kind which should be fairly simply to parse. This...

    Definitely Python - it does really well with file IO and string manipulation. An excel file should be a wrapper for a generic XML file of some kind which should be fairly simply to parse. This should take no more than a few hours and is really an excellent starter project for learning.

    1 vote