Merge spreadsheets via API? - google-sheets-api

I have a use case with a "master" Sheets file on Google Drive, and a new Sheet is emailed to a User, who then copy and pastes the data from the emailed sheet into the master sheet. I want to automate this process, does anyone know of a way to use the APIs to perform a "merge" of the 2 sheets?
Thanks in advance for any and all input.
John.

Related

VBA Excel lookup same value in different excel files

Would like to check the value from my master file and copy the data comments from different excel files.
In my master I have a column contained all the user name. Would like to copy the address of the user from different excel file. Would like to open the workbook and look through is the user name in the workbook, if not then then exit and open another workbook.
How should I complete the flow ?
Unfortunately StackOverflow is not a free coding service. Our goal is to help you understand how your code works and engage the community with questions that will also help others in the future. Try running some of the code on your own and see what you can come up with. There are hundreds of sources online, one of my favorite being "Excel Easy", a website that breaks down VBA coding to its simplest form. Check it out and then after you've given it a go yourself feel free to ask any specific question about your code!

Importing from multiple workbooks

I have completed some code to open multiple workbooks and copy data into one master workbook. I can't figure out how the code "chooses" which workbook to open first to import. Anybody have any ideas what is the method excel uses to select the files?
Take a look at this post over here. There is a link in the responses to a blog which talks about Window natural sorting method. Unless you specify in the code which files to open, VBA will normally open the files based on the natural sorting method.

Is there any way to block a workbook from "external" access?

first time asking something here, so I'll apologize beforehand in case I do anything I shouldn't do.
I'm working on a workbook and there are some information in it that shouldn't be available to everyone else, save a few users.
While doing some testing around I've found that it was possible to use another instance of Excel, i.e. another workbook, to access that information (in this case, using VBA).
What I want to know is: is it possible to block another instance of Excel or another workbook from accessing this workbook with the information I want to protect?
The point of this sheet in working on is to be used as a 'database' of sorts for performance feedback of other employees. They fill a form with their self evaluation and then their manager also fill it, evaluating them. All this is stored in a sheet, which is hidden (veryhidden, to be more specific). Using a simple login system, I was able to enable access to this sheet to only one user (one with admin privileges), but assuming someone knows the existence of that sheet, it would be perfectly possible for them to, for example, just copy everything from that sheet to a blank sheet in a new workbook.
Ultimately, what I'm trying to achieve is some kind of restriction in this workbook, allowing only it's own subs and functions to work on it
Thanks in advance
EDIT: Added some info. Hope that helped clarify my problem
The only way to achieve this is encryption. As far as I know Excel only supports one form of encryption, full workbook encryption. In that case there is a password to open the workbook, a user either has access to the full workbook or none at all.
Any other form of encryption in Excel, protected cells, passwords on macros, etc. can all be bypassed easily by a knowledgable user.
However, you could achieve this using either an external database server or implementing your own encryption scheme in the workbook.
There is some information here on howto access the Windows CryptoAPI from VBA.

Password Protect ALL Excel Macro Creation and Use

I have a spreadsheet that I have password protected from allowing users to edit.
I would also like to password protect ANY and ALL actions related to Macros within this spreadsheet. I don't want anyone to be able to create a new macro in this sheet, run an old macro in this sheet, or even run a macro stored in another place on the computer.
Is this possible?
This is not possible in excel. There may be some system adminy thing you can do with Group Policies to force macro security, but that would affect all excel spreadsheets for that user, and not just the specific one you want. The whole idea is Excel is a document, not an application. Documents by design are reproduced and shared, and what the end user does with it is his/her perogative.

Copy Range from Form, and Paste into Workbook (preferably closed)

I have a macro-enabled form that is intended to allow of a team of data-entry staff to record their daily efforts by transaction number. As forms go, it's pretty basic. However, I need to write a macro for a button that will let each person submit their records to a master sheet at the end of their shifts. I need to copy the range data and paste to a master workbook, with the person's name and the date being added to the individual rows.
I'm not sure how to facilitate the copy and paste to a closed workbook, or how to prevent problems with multiple people submitting to the form at the same time. Can anyone offer any suggestions please?
Make it update a database and then generate the report at the end of the day from that. I would also recommend that it inserts into the database each time the user inputs a record so that in the case of a power outage, all of their work from the day doesn't get lost. This will likely reduce the amount of concurrency issues too as the users will be periodically adding records instead of many records at the same time. Search 'VBA DAO' or 'VBA ADODB' to find examples on how to connect to a database with VBA.
You can do this simply by opening the workbook, inserting, and then closing the workbook. There is no simple way to insert into a closed workbook. Note, you could keep things hidden if you're trying to hide things from the user.
Add a reference to the "Microsoft Scripting Runtime" to get access to the filesystem and then use a simple file semaphore to control access to the common workbook.
Regarding the closed workbook, you use Application.Workbooks.Open(...) and .Close
Primary Choice would be to send the items to a database. Since thats already ruled out, I would suggest you write the data to a plain old .csv file. This will be easier to implement, and will not be limited by excel row limits.