Skip to main content

Easy Way To Save Excel Data in your Program

Lets face it, everyone still uses Excel for one reason or the other.  I think it's a great tool, especially for organizing and tracking information, creating quick budgets, lists, etc. 

Sometimes at work I get a request for the ability to store Excel data into our database.  For example, we have a QR Scanner that imports data into Excel.  We also have a Scan History table where we store all scans.  Note, we are able to scan traditional bar codes directly into the database, just not the QR Scans.

So, the user wants to copy the scan data into our history database but also assign some other information to it, like a PO Number.  So one of programs I've created is actually pretty simple.

You create a "textarea" input and give it whatever dimensions that seem reasonable.  I also added a Po Number text field for this example. The trick is to separate the data by tabs (but make sure the data itself has no tabs within the cells).  Below is an example of how I separated 3 columns of data, which I then save into the database:

arySkid = split(SONums, chr(13)) 'SONums is the name of the textarea

'reCreate the array b/c there are carriage returns in the front of the skid nos after the first one listed

        for x = 0 to uBound(arySkid)
          if x = 0 then
  SkidNos = trim(arySkid(x)) & ","
  if len(trim(arySkid(x))) > 1 then
     SkidNos = SkidNos & right(trim(arySkid(x)), len(trim(arySkid(x))) - 1) & ","
  end if
  end if

        SkidNos = left(SkidNos, len(SkidNos)-1)

        arySkid = split(SkidNos, ",")


for x = 0 to uBound(arySkid)

             xLen = len(trim(arySkid(x))) 'LENGTH OF THE ENTIRE STRING (PART NO AND QTY)
             SpaceStarts = InStr(trim(arySkid(x)), chr(9)) 'SHOWS WHERE TAB STARTS B/W PART NO AND QTY VALUE

             xPartNo = left(trim(arySkid(x)), SpaceStarts-1) 'PART NO VALUE
             xSection2 = right(trim(arySkid(x)), xLen-SpaceStarts) 'second section of data
             xLen2 = len(trim(xSection2))

             SpaceStarts2 = InStr(trim(xSection2), chr(9)) 'SHOWS WHERE the 2nd TAB STARTS B/W serial no and heci

             xSerialNo = left(trim(xSection2), SpaceStarts2-1) 'serial NO VALUE

             xHeci = right(trim(xSection2), xLen2-SpaceStarts2) 'last section of data
             'INSERT DATA HERE



Popular posts from this blog

2018 Goals Update

Wow, the month of January 2018 has flown by!  I cannot believe it's Feb 1 already!  But I will say I've been pretty happy with the progress of keeping my goals for the 2018 year!

Here's what I've kept to thus far:

1. Recite the Optimist Creed every morning (well at least during work days)

2. No more Mountain Dew in the morning

3. I've learned PHP and in the progress of learning C# and (progress is good!)

4.  I'm almost finished reading Soft Skills by John Sonmez (trying to read 1 book per Quarter)

5. Family vacation to Disney has been booked!

6. Blog has been started!

Book Review: The New Psycho-Cybernetics

The book The New Psycho-Cybernetics by Dr. Maxwell Maltz is truly an amazing book!  This book should be read by everyone!  Whether your self-image is good or bad this book talks about taking steps to improve your self-image, live a longer life, and ultimately be happy!

I myself feel like I have a good self-image, my self-esteem is high and overall I'm an optimistic and happy person.  But I can see how a book like this can help me strive for higher achievements and help me to reach those higher goals!

For those with poor self-images and low esteem this book will benefit you immensely.  The book talks about several examples where people have been down, sick, lonely.  But have gone through the exercises in the book and come out with a much better self-image and becoming much more happy.

There are so many examples in the book its hard to cover them all and that's why I will definitely be reading the book again, as well as a reference for future inspirations.  Towards the end of th…

Increasing Your Day's Productivity

So, there are a couple of chapters in John Sonmez's book, Soft Skills The Software Developer's Life Manual, that covers increasing your productivity.  Now, I consider myself a pretty focused person and pretty productive, but there's always room for improvement right?  Some sections talk about how ALL people procrastinate at some time or the other, but how can you get more focus and less procrastination (and minimize those distractions)?

Well, one of the recommendations is the Pomodoro Technique which is basically setting up blocks of time to focus, then take a break.  Usually in increments of 25 minutes of focused work, then a 5 minute break, then after each 4 small breaks you get a 15 minute break. 

There's a website called that uses this technique and helps you track your time and your tasks, projects, etc.  I've been using it for about one week now and I really like it and I can tell I have become even more productive.  I know exactly what I need …