How to improve refresh for Excel Data Connections? - excel

Like many, I have spreadsheet that draws data from over 40 text files as data sources. The text files are from another app, and need to be periodically updated into Excel.
The set of data source files and spreadsheet need to be able to be duplicated and run on different systems. This is where the astonishing inability of Excel to support data import from the spreadsheet folder (or relative paths at all) becomes a big problem. This question mentions the issue but has no solution.
I developed a crude workaround for this (IMHO) fundamental flaw in Excel. Map your spreadsheet folder to a drive letter with SUBST. Then import the data from the SUBST drive letter. That drive letter and path will become part of the spreadsheet, buried deep in dialogs, and very inconvenient to update. So instead, whenever you copy or move the spreadsheet, re-create the SUBST to the current folder. Ugly, but effective.
New Question: Using this technique, when I open the spreadsheet and click Refresh to refresh from the data sources, I have to click "Import" on over 40 dialogs - one for each file. How can I automate that process?

I discovered that under a data range properties, there is a setting for "Prompt for file name on refresh". By unchecking that, it is no longer necessary to click import for every linked file. The properties for each linked data source must be adjusted individually. There doesn't seem to be any ability to multi-select data sources.

Related

Vba code in original file to track all copied files

Is it possible to insert a code so we can track all copied excel files in the future?
The reason why: we are creating a template excel file that people can copy and fill in. The problem is that they regularly have to fill in the same information so instead of starting from the template they copy the already filled in template.
If we decide to change the template, we want to change all the files that were copied so there are no multiple versions going around.
All the files are stored on a server in subfolders so We can access them all. Titles of the file will vary based on the wishes from the customer.
After reading you, I see that:
Summary:
You have one single Template that everybody copies
You store all the filled templates on one Server Subfolder
Title of the Files varies from Customer's needs
Challenges:
For Performance shake, you might need of a program than Excel to manage those files
Otherwise, it is possible to use Excel VBA, but is somehow/enough complicated so you would need to have an advanced skills and enough time to write everything handling that Subfolders' file renaming if you wish to collect the data in one Single Excel.
Suggested Solution:
I recommend you to have A Locked Worksheet + Workbook Excel
Template so your customers won't be able to edit its structure and
it will keep all of your templates to be the same.
You better have some kind of the Standard in the nomenclature of your Excel Files which will help you use that description later on for search/filter/sorting ...
You can have a Reset Button as well within the Template where your customers will click and will empty all the fields effortless.
In short, If you wish to track of files being copies, you would need more than Excel VBA for that as you need to play with A windows service for you to track them.
Hope this will give you some ideas. All the Best!

Multiple user editing single Excel file using Single GUI

could anyone suggest a way multiple user can access single Excel file(Database) using Single userform. I have a system where multiple users have to update single excel file (Adding or deleting record). So could any of you suggest how should i proceed. I know this is an software process question rather than a software code question. But still asking, if Anybody could help me as i cannot find a feasible solution to do so.
When you have a network share available, would 'Shared Workbook' do the trick? (sounds a lot like it to me). You basically check a box that the workbook is from now on 'shared'. Excel will allow several users in parallel to open the same file for editing. It will make sure that everyones writes end up in the file (and that each save gives you others' edits).
You can find more info e.g. here: https://support.office.com/en-ie/article/About-the-shared-workbook-feature-49b833c0-873b-48d8-8bf2-c1c59a628534?ui=en-US&rs=en-IE&ad=IE
This may not be what you want, but you an have multiple users editing multiple files, but have the data combined into a single file. This will work as long as you have a fixed maximum number of data editors (say 20). Just create a simple data entry file with the userform built in that stores the data entered in a sheet. Now create 20 copies of this, one for each user, and store them in a file sharing environment like SharePoint or a shared network drive. Now you can have the master "database" file aggregate them into a single file by using workbook links.
In order to be able to do things with them as if they were a single data set, you need to do a sort of union of the data, which is not straightforward in Excel. Again, you need to establish a hard maximum size for each user to edit - for example, 5000 rows. On a Sheet in your database workbook, designate rows 2-5001 for the first user, then leave an empty row (usually I color it black to make it easy to spot), then 5002-10003 for the next user, etc. In Cell B2, put the formula
=if('J:\Network folder\[Data Entry 1.xlsm]DataSheet'!B2="","",'J:\Network folder\[Data Entry 1.xlsm]DataSheet'!B2)
and fill that to all the cells in that range (down to row 5001). Then repeat in the next range (B5002, for the second range:
=if('J:\Network folder\[Data Entry 2.xlsm]DataSheet'!B2="","",'J:\Network folder\[Data Entry 1.xlsm]DataSheet'!B2)

Tracking Changes in Excel - to see only changed rows

I have a very big shared Excel spreadsheet with changes made in some of the columns. I need to create a new spreadsheet which pulls from that big spreadsheet only the rows containing cells that have been changed - in other words all rows' numbers marked as read by Excel.
Very important thing is that all the changes still have to be VISIBLE (new and old values). Do you have any idea how to do it?
I am sorry if this question sounds stupid to you but I am a complete amateur and I need something to start with...
You can Track Changes on MS Excel. But there are some rules for that.
It is available only in Shared Workbooks.
Workbooks that has tables CAN NOT be shared.
To share a workbook you need to disable some privacy settings
Go to: File-> Excel Options -> Trust Center (again Trust Center button)
Under the Privacy Options category, under the Document-specific settings, uncheck the "Remove personal information from file properties on save"
Then Click OK
Now, you can share your workbook under Review Tab, Changes group.
When you click Share Workbook command, it asks you some rules for sharing and change tracking. Choose properties which fits you then click OK.
Your workbook is now shared and you can easily Track Changes under Review Tab, Track Changes method group.
You may highlight the changes on screen and you may see changes on the history window. You may also Accept/Reject the changes.
Don't forget: Workbooks that have tables can not be shared. You can Convert To Range your tables before start sharing under Table Tools/Design backstage tab.
I think your simplest option is to manually 'version control' your files by saving your versions under a different filename (_v1.xlsb, _v2.xlsb etc).
You could then use Microsoft's Spreadsheet Compare tool (https://support.office.com/en-gb/article/Basic-tasks-in-Spreadsheet-Compare-f2b20af8-a6d3-4780-8011-f15b3229f5d8) to diff any two versions and see the modified rows.
Another solution would be to use a commercial solution. I know that sharepoint (https://support.office.com/en-us/article/Track-versions-of-a-file-in-a-SharePoint-library-54578c95-0538-407a-bc05-ea34d614f9e4) do document revision tracking (though I am not sure how much they give you in terms of diffing).
I have been working on a solution to this problem (www.pathio.com) where revisions of an Excel workbook get versioned in the background and an audit log with diffs is generated. I've put together an example of a diff here: https://app.pathio.com/bjoernstiel/Cashflow.xlsb/diff/sheets/Sheet1?version=c079909def1716c833e431e3a9ca1d1b2f5705d0

Excel Files and Visual Basic

I have never used Visual Basic before but could do with a pointer on where to begin.
I have 750 excel spreadsheets that contains various amounts of data of different types. The columns are always the same, but the number of data rows vary per spreadsheet. I need to extract data and put it into two new spreadsheets.
Obviously to do this 750 times manually would be a nightmare. I just want to run a script that can do it for me and thus thought of Visual Basic although i've never used it before.
My specific questions are:
What type of command should i research that would allow me to copy data where the row number to start at varies (as data above varies in no of rows). There is a title before this new data - how can i get it to search for this title and then choose the row below?
Would all my spreadsheets have to be in one folder so that the script goes through them all, or can i have some kind of folder structure in that folder too?
Anyone recommend any good resources for me to get to grips with visual basic and grasp what i need to do?
thanks
Tom
So the compilation task got easier with the introduction of MS PowerQuery. If you are using MS Excel 2013, you already have this. If no, you should download it and use the extension from MS.
The following guide outlines how to Using Power Query to Combine Data from Multiple Excel Files into One Table. This means that with Power Query (PQ), MS has taken and enabled easy aggregation using a few simple button clicks. PQ is a lightweight alternative to a lot of tasks that used to require VBA.
In this example, you will use PQ to point to an entire folder (750 should be no problem) worth of commonly formatted Excel files. The only limitation is that each data file should have a similarly named tab.
I won't repeat the details of the guide for how to do it, as it is in-depth and visual. But if you run into issues, get in touch.

How to import xls into Azure Database?

Our database needs to be filled with the zip code for every state in our country, we are provided with a catalog of zip codes in a xls file, we have to import this file to a table in a database hosted in Windows Azure.
I don't know if Stack Overflow allows me to post a link to our xls, but I'll describe the structure of the file:
Every sheet holds the zip code information for a whole state, inside every sheet we have fifteen columns with information such as zip code, type of terrain, type of area, locality, state, city, etc. Every sheet has the same columns and the information inside the cells may contain special characters (i.e. á, é, ó, ú, etc.) normal to Spanish language and this special characters need to be preserved. Also some cell may be empty or not and blank spaces are likely to appear in the contents of the cells (i.e. Villa de Montenegro).
We are looking for a way to import every sheet into our table without losing special characters or skipping empty cells. We have no prior experience doing this kind of task and wanted to know what is the best way to import it.
We tried a suggestion of importing the xls to CSV files and then importing those CSV to our database, but we tried some of the variations of the macro recommended here but the CSV are generated with many errors (Macros aren't our forte).
In short, what is the best way to import our xls to an Azure database table without losing empty cells, special characters nor failing when blank spaces are inside a cell?
I recently had to migrate some data in a similar way. I used the SQL Server 2014 Import and Export Data Wizard. I initially tried with a .csv, but it was finicky about quoted commas and such. When I saved it as a .xlsx file, I was able to upload it without a problem. It's pretty straight forward to use, just select your xls file as the source, configure the connection to your Azure database, next-next-next, and hopefully you get the happy path. I wrote about it on my blog, step by step with screenshots.
We found an easy, although slow, way to copy the contents from an xls using Visual Studio, the version we used was 2012 but it works with 2008 and 2013 too.
Open the Server Explorer.
Add a new connection, the url for the database is required, the credentials are the same as the ones you use to access the database on Azure. Test the connection if you like, if the credentials are correct then you're good to go.
After the connection has been made, expand the Tables section and select the table you wish to dump your data.
Right click and select view table data.
If the table is empty or it has already some data, the workflow is the same. The last record will be empty, select it.
Go to your xls file, for this to work, the number and order of the columns must be the same as the table you will be dumping the data. Select the rows desired, copy them.
Return to Visual Studio, while the last empty row is selected paste the data. The data will start to copy directly into your Azure database.
Depending on your internet connection and the amount of data you're coping, this might take a long time.
This is an easy solution, although not optimal. This works if you don't own SQL Server with all of its tools. Still gotta check if this works on the express edition, will update when I test.

Resources