Python Forum
Complete NEWB and openpyxl project
Thread Rating:
  • 6 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complete NEWB and openpyxl project
#1
Greetings!

I've butchered various programming languages in the past, learning to hack my way through simple problems, but have never really become proficient in any of them. This year I decided that I would actually learn Python and stick with it. So, I'm a newb, but dedicated to continuing to learn.

My son-in-law helped me to create a solution for a previous employers of mine, which he wrote in Perl. I thought that, perhaps, that would be a nice basic challenge for me to redo in Python since I already had a basic idea of what might be involved, though the code would be much different.

The project takes an Excel workbook (only 1 sheet) that has rows of data with one column (named Reorder) containing values that are some number of alpha characters (less than 6, historically) and a single digit.

The desired outcome would be that all records would be filtered according to that digit on the end; all that ended with a '1' would be Group1, with a '2' would be Group2... and so on.

Once that was accomplished, each group would be sorted by the alpha values in the Reorder column.

All of the Group1 records would be put into a new Excel workbook named for the Group of records (e.g. Group1.xlsx, Group2.xlsx... etc).

Inside each of these Group workbooks would be separate worksheets (alphabetized) for each unique alpha/digit string (e.g. ABCDE1, BCD1, MNOP1, -OR- ABCDE2, JKM2, MNOP2... etc).

I've gotten through the baby steps of checking for the existence of the source folder and creating it if not there (originally set up so that different people could use the program the in exactly the same way, regardless of what computer it was on). I also have it check to make sure that there is one, and only one .xlsx file in this folder.

I've gotten it to create a new folder in the working folder that is named after the excel file without extension. Copy the original Excel file to that folder, and then change the working folder to that new folder.

From there, I've been able to get openpyxl assign a variable for the source workbook, assign a variable for the worksheet... and now I've sort of gotten lost.

In Perl, my son-in-law used (from Excel::Writer::XLSX) functions 'maxcol' and 'maxrow', so I tried to use max_col and max_row with openpyxl, but wasted a lot of time before realizing that they return the maximum rows and columns in Excel::Writer, but seem to assign them in openpyxl. I also wasted time reading older posts which referenced deprecated commands.

I've read through the documentation at https://openpyxl.readthedocs.io/en/stable/ but haven't gleaned much that seems like it would help.

I have found wb.calculate_dimension(), which I guess I can take the output from. Not sure how to go about the separating and sorting either.

Have I chosen the best tool with openpyxl, or is there something else I should be looking at? Does anyone know of a comprehensive listing of all of the functions/commands and their current names and usages within openpyxl? I have found precious little thus far.

I'll post an example of the type of data in a screenshot.

If you're still here, thanks for even reading this far! Any and all help is appreciated.

Joe

[Image: TestImmuneData.xlsx%20-%20Excel.png?dl=0]

Looks like you'll have to click the broken image icon to display the image. :(
Reply


Messages In This Thread
Complete NEWB and openpyxl project - by Netopia - Jan-09-2019, 08:06 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-09-2019, 08:44 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-09-2019, 09:43 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-09-2019, 09:46 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-09-2019, 09:53 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-09-2019, 10:11 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-09-2019, 10:14 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-10-2019, 06:26 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-10-2019, 07:37 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-10-2019, 08:03 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-10-2019, 08:30 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-10-2019, 08:36 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-10-2019, 08:39 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-11-2019, 01:19 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-11-2019, 01:44 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-11-2019, 01:48 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-11-2019, 01:54 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-11-2019, 01:57 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-11-2019, 02:47 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-11-2019, 02:54 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-11-2019, 03:00 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-14-2019, 07:20 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-14-2019, 07:44 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-14-2019, 08:24 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-14-2019, 08:27 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-15-2019, 12:22 AM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-15-2019, 02:56 AM
RE: Complete NEWB and openpyxl project - by buran - Jan-15-2019, 10:05 AM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-15-2019, 02:14 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-15-2019, 02:21 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-16-2019, 04:36 AM
RE: Complete NEWB and openpyxl project - by buran - Jan-16-2019, 07:04 AM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-16-2019, 03:29 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-16-2019, 05:19 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-17-2019, 04:59 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-17-2019, 05:08 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-17-2019, 05:33 PM
RE: Complete NEWB and openpyxl project - by buran - Jan-17-2019, 06:04 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-17-2019, 10:19 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-18-2019, 03:31 AM
RE: Complete NEWB and openpyxl project - by buran - Jan-18-2019, 07:07 AM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-18-2019, 02:15 PM
RE: Complete NEWB and openpyxl project - by Netopia - Jan-18-2019, 08:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python newb need help Fictile 1 190 Apr-02-2024, 03:28 AM
Last Post: buran
  NameError issue with daughter's newb code MrGonk 2 1,448 Sep-16-2021, 01:29 PM
Last Post: BashBedlam
  Simple newb string question Involute 2 2,202 Sep-08-2019, 12:50 AM
Last Post: Involute
  please help this newb install pygame iofhua 7 5,922 May-15-2019, 01:09 PM
Last Post: buran
  Newb question: Debugging + Linting Python in Visual Studio Code Drone4four 1 2,420 Apr-15-2019, 06:19 AM
Last Post: perfringo
  Newb question about %02d %04d bennylava 30 19,410 Mar-05-2019, 11:23 PM
Last Post: snippsat
  Pthyon 3 question (newb) bennylava 11 5,839 Feb-28-2019, 06:04 PM
Last Post: buran
  newb selfie PatM 5 3,602 Feb-19-2019, 12:20 AM
Last Post: snippsat
  Newb Question - Threading in Crons vvarrior 2 2,772 Jul-20-2018, 08:12 PM
Last Post: vvarrior
  Matt's newb question 1 MattSS102 1 2,692 Aug-28-2017, 03:27 AM
Last Post: BerlingSwe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020