Flatten excel spreadsheet for ms sql server use - sql

I Found this spreadsheets online which I would like to flatten out and import into a MS SQL Server Database. The issue is that the spreadsheets have the same layout but is in a report format.
Any suggestions on how to flatten out this spreadsheet as there are to many sheets in one of this spreadsheets to do this manually. There are also a couple of different years of spreadsheets.
Click here to open one of these spreadsheets
I want to be able to import this into my database and play with the numbers

I would recommend creating a staging area and importing each of the tabs into it's own specific table. This would give you the flexibility to work with the data initially. Then you would be able to easily flatten the data and transform it to your specifications. Also, this would be a good approach if you wanted to bring in only a couple of tabs in the beginning and flatten them. You could then extend the dataset by bringing in the tabs as you wanted to process them.

Related

MS Access Modern Charts - VBA adding trendline

I would like to use VBA to format MS access modern charts in forms, for example adding a trendline, turning on data labels etc. I have searched but cannot see any methods or data structures to do this. Can anyone point me in the correct direction?
This may give you what you want.
https://www.youtube.com/watch?v=0QADS5XxVIs&ab_channel=Microsoft365
Keep in mind...Access is a NOT a great tool for creating charts. As an alternative, you may want to import your data into MS Excel, from Access, and create your Trend Line in Excel. There are so many ways to move data between Access and Excel, back and forth, so if you get stuck with one app, just switch to the other app!

How to insert large amounts of data from excel spreadsheet into Oracle SQL Developer

I have been able to load smaller amounts of data from Excel sheets into Tables in Oracle SQL Developer.
I am having a tough time loading the data from this one excel sheet into the tables. The Excel Spreadsheet has 20 columns and 205,000 rows.
It does not let me import data into the table, complains about java heap space being too large or the error message below
So I make an insert statement in the excel sheet, when I copy and paste it in the SQL Developer, it says the selection is too large to paste.
How do folks in big corporations handle this situation, I am sure they have Millions of rows? There has to be some kind of technique to load this data into the tables.
I tried Youtube and Google, almost every one of them shows videos of Importing data from Excel into a table in Oracle SQL developer with 20-100 rows and 3 columns. Which is pretty straightforward.
Any suggestions, links, videos will help.
You can increase the amount of memory available to SQL Developer. Edit the sqldeveloper.conf file and add:
AddVMOption -Xmx1024M
Change the number to be however much memory you want to allocate.
However, I question whether SQL Developer is the best tool for this. You could try converting your data to a CSV and loading it using Application Express, if that's available in your database.
You've got two options, #eaolson has already discussed the first.
Second option, save your Excel file as a CSV. It'll rip through the CSV MUCH faster than Excel.
Why is is faster? An Excel file is actually an archive of multiple XML files. Parsing, reading those are a pain.
That being said, I've imported 1,000,000 rows from Excel to Oracle using SQLDev w/o making any changes to the JVM before.
Having lots of columns and lots of rows, will add up quickly. If your'e going to be doing this multiple times, you can automate this with SQLcl and the LOAD command (assuming you save your Excel to CSV/delimited text files).

Updating an Excel like a mobile app

I created an excel workbook to track inventory for a project that my wife is working on. It does a ton of useful things for her but I have so many other good ideas for it to do more. It has gained some attention from some of her friends and I would really like to share it with them but keep everything locked so that they cannot accidentally mess anything up. With that said, I want to keep developing it as I come up with improvements.
My question is, does anyone know a way that I can basically release versions of an excel just like a a code upgrade? I want to be able to pass this thing along and then when I make some improvements I can release them but nobody loses any data or has to copy and paste data. Would this be something I could accomplish with VBA? anyone have any thoughts?
I had a similar problem a few years ago.
I ended up using two VBA macros to automate data migration from the old version of the workbook to the new version. Here are the high level steps:
Step 1:
Lock all of the cells except the inputs and options to the model so that you know where each piece of data is located (named ranges are helpful here).
Step 2:
Write a VBA macro to scrape the values out of the unlocked cells and save them into a CSV with a particular format.
Step 3:
Write another macro to load in the CSV you created in step 2 and fill those values in to the input cells.
Step 4:
Add in a few buttons to your workbook so that your users can easily access both macros.
When your users want to upgrade from one version to the next they will export their data from the old workbook into the CSV and import it to the new workbook. There are more elegant solutions but in my opinion they aren't worth the extra effort to implement and maintain.
Depending on what you're doing Google Sheets could be a good alternative too!
Apps can be easily updated because most of them have separate files for data, settings, user interface and functionality. In Excel usually all of that is combined in only one file, so it is very hard to separate them and update only the functionality without affecting the data. If you can figure out how to store the data in separate files, then updating would be easier.

Intuitive auto-population of data between two worksheets

I have two excel tables. One is a list of names with a calendar that tracks number of days traveled and puts it in percentage. The other table shows proposed travel schedules for the same list of people but in a different format. I have to manually find their percentage in table 1 and input them to the second table for presentations. I want to develop something that reads the names in both tables and can copy their travel time percentage into the second chart. Maybe adding it in the cell or to a blank row below. I have been unable to find any previous threads relating to this. I am new to programing and do not know if this can be done in VBA macro for excel. Does anyone know what functions I could use to accomplish this?
The quickest way is to use powerpivot. You'll have to look at your version of excel to see how to access it. For instance, powerpivot is included and preset in excel 2016, and is a free add-on you'll need to download for excel 2010.
You can uplaod both those tables into the powerpivot model, define the relationship between the two tables (as simple as dragging the relationships in a diagram view). Then you literally have a pivot table that connects both and you can create a measure that does what you're saying. The plus is that there's so much more you can do!
Hearing how your data is set up if you run through a powerpivot table tutorial you might even rethink your data set-up. The advantage is you don't need to learn vba just learn to apply your current and new excel skills. A good starting point is here:
https://msdn.microsoft.com/en-us/library/gg413497(v=sql.110).aspx
There are also 5 min youtube clips that'll give you a good idea of what else you can do with it.

Is there a way to run excel code in sql or run small datasets in excel and export to SQL automatically?

I'm perfectly happy with excel; I know the codes and I find the interface very intuitive. The only problem I have now is that I have lots of formulas in several columns, which are linked to other excel files and am tracking sales over time. Currently I have 1500+ rows of data and sometimes Excel has trouble to calculate all the necessary codes and I need a way to make sure that into the future, when there are 10000+ or more rows, it is possible to run the code without Excel stopping/freezing. My boss says using SQL should help. However, I am unfamiliar with it and know that excel and SQL can be used similarly.
Ultimately, I want to know if I can run the excel code in SQL or if I can calculate small datasets (sets that are pulled periodically) in excel and them export to SQL automatically instead of having to go through the wizard for importing data. Also, I would need to attach the small datasets into the large one. Any ideas other than just learning SQL? This needs to be accessible to many people who don't know SQL so simply learning SQL isn't too helpful.
If you're familiar with Excel and its formulas, it won't be too arduous for you to pick up on SQL. In addition to that, I can copy and paste outputs from SQL Sever into Excel sheets that have a graph auto-built (since I use Express) and it's a simple copy-and-paste into an Excel sheet.
While I don't know all your calculations, I haven't seen Excel be able to do something that SQL couldn't do and when you consider the benefit of indexing among the freedom to organize your data how you want (and have saved stored procedures), a switch might only be temporarily inconvenient while you pick up on SQL, and after that, you'll easily produce what you need.
Ultimately, I want to know if I can run the excel code in SQL
Not always exactly identical, but you can run similar structured code. For instance:
SELECT AVG(Sales) "AverageSales"
FROM Sales
VERSUS
=AVERAGE(A2:A2000)
or
SELECT (((DollarToday - DollarYesterday)/DollarYesterday)*100) AS "DollarDelta"
FROM USD
VERSUS
=(((A2-A1)/A1)*100)