Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Merging Multiple Excel Tabs into a database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Merging Multiple Excel Tabs into a database

    Which leads us, inevitably, to cleaning up the original tab by tab csv files we no longer need.

    Code:
    combined_count = line_count(to_combine)
    	combined = file.to_string(word(to_combine,1,crlf()))
    	save_to_file(combined,"c:\temp\xlscombined.csv")
    	file.remove(word(to_combine,1,crlf()))
    for qz = 2 to combined_count
    		next_file = file.to_string(word(to_combine,qz,crlf()))
    		next_file = *LINE_REMOVE(next_file,1,1)
    		save_to_file(next_file,"c:\temp\xlscombined.csv",.T.)
                    file.remove(word(to_combine,qz,crlf()))
    next qz
    There can be only one.

    Comment


      #17
      Re: Merging Multiple Excel Tabs into a database

      You Are a Good Man, Stan !!

      Actually I had another couple of ideas, but I should probably try to implement and share back for all the work you have shared.
      I think it is really great that you have offered this up and I very much appreciate it !!

      Regards,
      Keith
      Keith Weatherhead
      Discus Data, Ltd
      [email protected]

      Comment


        #18
        Re: Merging Multiple Excel Tabs into a database

        This should be faster on large workbooks. The portion to close the csv files and reopen the original workbook has been replaced with code to select the activesheet, copy it, save the activesheet as csv. The original remains open.

        Code:
        'Date Created: 08-Jul-2002 10:14:12 PM
        'Last Updated: 10-Oct-2013 09:48:32 AM
        'Created By  : SMathews
        'Updated By  : SMathews
        'sample usage - ex_splitter("c:\data\my_big_file.xls")
        'creates a csv file of each tab of docName in c:\temp
        'filename will be 'file tabname.csv
        FUNCTION ex_splitter2 AS L (docName AS C)
        	ex_splitter2 = .F.
        	Dim xlApp as p
        	Dim myCell as c
        	Dim to_combine as C
        	to_combine = ""
        	Dim sht_name as c
        	sht_name = "Master"
        	
        	xlApp = ole.getobject("","Excel.Application")
        	xlApp.Workbooks.Open(docname)
        	'debug(1)
        	'xlApp.Visible = .T. 'comment this line out if you don't want to see Excel
        	IF xlApp.ActiveWorkbook.ReadOnly
        		ui_msg_box("Alert","Halting because file is read-only.",UI_OK)
        		xlapp.DisplayAlerts = .F.
        		xlApp.Workbooks.Close()
        		xlapp.DisplayAlerts = .T.
        		xlApp.Quit()
        		delete xlApp
        		exit function
        	END IF
        	shts = xlApp.Worksheets.Count
        	for qx = 1 to shts
        		xlApp.Worksheets(qx).Select()
        		chk = xlApp.ActiveSheet.Name
        		lastrow = xlApp.Activecell.SpecialCells("11").Row
        		lastcol = xlApp.Activecell.SpecialCells("11").Column
        		lastcell = xlindx_to_txt(lastcol)+lastrow
        		xlApp.Range("A1:"+lastcell).Select()
        		xlApp.Application.DisplayAlerts = .F.
        		fil_name = "c:\temp\file "+chk+".csv"
        		xlApp.Application.ScreenUpdating = .F.
        		xlApp.ActiveSheet.Select()
        		xlApp.ActiveSheet.Copy()
        		xlApp.ActiveSheet.SaveAs(fil_name,6,.F.)
        		xlApp.Application.ScreenUpdating = .T.
        		xlApp.ActiveWorkbook.Close()
        		xlApp.Application.DisplayAlerts = .T.
        		to_combine = to_combine +fil_name+crlf()
        	next qx
        	xlApp.Quit()
        	Delete xlApp
        	combined_count = line_count(to_combine)
        	combined = file.to_string(word(to_combine,1,crlf()))
        	save_to_file(combined,"c:\temp\xlscombined.csv")
        	file.remove(word(to_combine,1,crlf()))
        	for qz = 2 to combined_count
        		next_file = file.to_string(word(to_combine,qz,crlf()))
        		next_file = *LINE_REMOVE(next_file,1,1)
        		save_to_file(next_file,"c:\temp\xlscombined.csv",.T.)
        		file.remove(word(to_combine,qz,crlf()))
        	next qz
        	ex_splitter2 = .T.
        END FUNCTION
        FUNCTION xlindx_to_txt AS C (colnum AS N )
        	If Colnum > 26 Then
        		xlindx_to_txt = Chr(Int((Colnum - 1) / 26) + 64) + Chr((mod((Colnum - 1),26) ) + 65)
        	Else
        		xlindx_to_txt = Chr(Colnum + 64)
        	End If
        END FUNCTION
        There can be only one.

        Comment


          #19
          Re: Merging Multiple Excel Tabs into a database

          Stan,

          Yet again, you've upped the bar before I can even implement the original version, lol....
          THANX for all your efforts !!!

          Regards,
          Keith
          Keith Weatherhead
          Discus Data, Ltd
          [email protected]

          Comment


            #20
            Re: Merging Multiple Excel Tabs into a database

            The best approach is often a journey, not a destination.
            There can be only one.

            Comment


              #21
              Re: Merging Multiple Excel Tabs into a database

              About how many rows in each tab?
              Do all these tabs have the same column headings?
              Are these column headings the same in each file?

              Comment


                #22
                Re: Merging Multiple Excel Tabs into a database

                Originally posted by G Gabriel View Post
                About how many rows in each tab?
                Do all these tabs have the same column headings?
                Are these column headings the same in each file?
                G

                I think post 14 and 1 explain what the circumstances are.

                1. https://forum.alphasoftware.com/show...l=1#post657157

                14. https://forum.alphasoftware.com/show...l=1#post657209

                Importing is so much fun...

                Is there something that you are considering as an alternative to Stan's idea?
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                http://www.iadn.com/images/media/iadn_member.png

                Comment


                  #23
                  Re: Merging Multiple Excel Tabs into a database

                  Originally posted by G Gabriel View Post
                  About how many rows in each tab?
                  Do all these tabs have the same column headings?
                  Are these column headings the same in each file?
                  Varies... Usually they are the same for each tab in a file, but not always, which means my first task is to determine that and adjust tabs so that is the case in my copy of the supplied data, as I try to always leave an unaltered version of the client supplied data as a backup or restore point. Some files (and tabs) have just a few columns of data and some are 40 to 50 (or more) columns wide. There simply is no standard answer/version as we go from company to company. Some are getting data out of Oracle, SAP, DB2, JD Edwards, PeopleSoft, and a slug of home-grown solutions (legacy systems). Some IT departments give you everything including the kitchen sink, other are stingy and barely give you what you need to do the work. If you can imagine the diversity in data that *could* be supplied, double that for reality.
                  Keith Weatherhead
                  Discus Data, Ltd
                  [email protected]

                  Comment


                    #24
                    Re: Merging Multiple Excel Tabs into a database

                    Importing is always a ball, lol, NOT !!!

                    I continue to look for alternatives, I found a possible solution that someone pointed me toward, but have yet to be able to investigate further. We are on a brutal travel schedule currently, 5 out of 6 weeks but something like 10 out of 12 before this run actually ends, we just completed week #4... I am hoping to have something in place soon, I will probably start with Stan's work as a base point, as I like what he has done and it will initially work with some of my personal ideas for what I would like to see. I have another week before I get a week at home and that might be as soon as I get to try and implement some of my ideas. The week after my week at home we will be going back to a client that supplies millions of lines of data and it would be nice to have even a crude version of my idea working as it would certainly make my life easier there. Time will see if that actually happens though.

                    Keith


                    Originally posted by Al Buchholz View Post
                    G

                    I think post 14 and 1 explain what the circumstances are.

                    1. https://forum.alphasoftware.com/show...l=1#post657157

                    14. https://forum.alphasoftware.com/show...l=1#post657209

                    Importing is so much fun...

                    Is there something that you are considering as an alternative to Stan's idea?
                    Keith Weatherhead
                    Discus Data, Ltd
                    [email protected]

                    Comment

                    Working...
                    X