+ Reply to Thread
Results 1 to 7 of 7

How do I save data I'm collecting in Python for Excel.

  1. #1
    Registered User
    Join Date
    05-07-2017
    Location
    NY, USA
    MS-Off Ver
    MS Office Professional 2016
    Posts
    1

    How do I save data I'm collecting in Python for Excel.

    Hi and Help!

    I'm VERY new to Excel, but recently have a need to save data I'm collecting from a Python script to Excel so I can easily review, search and display information.

    I'm collecting data on 100,000+ 'systems' where each 'system' has a serial number, model, date and country, also each system has a number of components (component number and related description)

    Would it be best to save each 'system' in a row?
    example:
    [serial1] [model] [date] [country] [com1 num] [com1 desc] [com2 num] [com2 desc] ....
    [serial2] [model] [date] [country] [com1 num] [com1 desc] [com2 num] [com2 desc] ....

    Would I be able to search ANY cell and display all systems that match, 1 system per row, or in sheets?

    Can I 'nest' or 'hide' system information OR display system information in a more readable format after a search?
    example:
    [serial] [model] [date] [country]
    [com1 num] [com1 desc]
    [com2 num] [com2 desc]


    Appreciate any help, thanks !

  2. #2
    Registered User
    Join Date
    04-25-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    3

    Re: How do I save data I'm collecting in Python for Excel.

    Would it be best to save each 'system' in a row?
    This should work, along with adding column names.

    Would I be able to search ANY cell and display all systems that match, 1 system per row, or in sheets?
    The basic control-F would allow you to search across all cells, but it might be cumbersome for such a large data set.

    If you're familiar with SQL, OpsLab let's you import CSVs into a database - then you can search using SQL. From there, you can export the search results into a CSV file.


    Can I 'nest' or 'hide' system information OR display system information in a more readable format after a search?
    It sounds like this would require a macro for custom search that produces a new sheet with the results formatted that way. In OpsLab, you'd be able to query for an individual system.
    solving problems at Amdirent, Inc

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How do I save data I'm collecting in Python for Excel.

    Where are you currently storing the data generated by the Python script?
    If posting code please use code tags, see here.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: How do I save data I'm collecting in Python for Excel.

    You would need a macro to transform your existing data into a normalized format (I am assuming that each system has a varying number of com numbers and com descriptions). Then you can use a pivot table to order up the data as you described.

    Please attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: How do I save data I'm collecting in Python for Excel.

    Quote Originally Posted by tebbens View Post

    I'm collecting data on 100,000+ 'systems' where each 'system' has a serial number, model, date and country, also each system has a number of components (component number and related description)
    This simply screams for proper DBMS. That number of records for systems + records for components - it will turn into nightmare very soon if dumped in an workbook.
    You can choose from number of database systems for back-end and [eventually] use the Excel with ADO for queries, reports, etc.
    The choice of a DBMS will depend also on your Python script and your ability/desire to develop it, rather than introduce excel too early if at all in the work-flow.
    Last edited by buran; 05-09-2017 at 04:34 AM.
    If you are pleased with a member's answer then use the Star icon to rate it.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: How do I save data I'm collecting in Python for Excel.

    @buran - you are probably right. What tebbens is probably looking at is a cross-query output. The data does exist in the correct format in the database and is "stretched out" for displays to humans. A straight query to get the data in normalized format is probably what is really needed here.

    I pull data from Oracle all the time in a normalized format and use the Excel table it comes into to do some computations and to play with pivot tables and charts. Database + Excel is a winning combination if done right.

  7. #7
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: How do I save data I'm collecting in Python for Excel.

    I also have projects - both for my personal needs and for clients that use MySQL and MSSQL as backend and use Excel for front-end. In other cases I use python scripts that work with DB and produce reports in Excel. Python also has nice tools - Pandas, Numpy, number of packages to work with Excel, etc. and depending on data/transformations/calculations it could be easier to do the data heavy-lifting in Python

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. python in excel
    By idandush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2015, 04:26 PM
  2. Can you use (or compile?) Python code in Excel
    By mrvp in forum The Water Cooler
    Replies: 7
    Last Post: 06-08-2014, 06:49 AM
  3. collecting data from numerous sheets and collecting into one
    By molesy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2014, 02:03 PM
  4. call a python script from excel vba
    By sheffieldlad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 07:11 PM
  5. [SOLVED] Can Excel solve my problem or do I need Access / Python?
    By MHT888 in forum Excel General
    Replies: 11
    Last Post: 01-13-2013, 02:54 PM
  6. Python commands in Excel
    By ljoseph in forum Excel General
    Replies: 0
    Last Post: 09-18-2009, 07:02 AM
  7. Excel and Python
    By davidlawrence in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2008, 08:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1