Django Spreadsheet Form - mysql

I have a form in Django that adds users to a mySQL database. However, the user will have to add tons of users, and some information will be copy and pasted. So I was thinking if there is a way to have a spreadsheet like form, where the column titles would be the fields that will be added to the database (such as id, firstname, lastname, etc...) and every row would be an information associated with one user. When you click the submit button, it will add each row to the database. Again, the user will need to have the ability to copy a row and paste it to another row. Thanks!

Probably the easiest thing is to get the users to use an actual spreadsheet and save it as CSV, then provide a facility to upload and process that CSV.

Related

Data entry form responses directly to a template

I have created a data entry form in Google Sheets, and would now like the data to be placed in my templates cells automatically. The user fills out a form, and ideally the answers would fill out the template and execute the calculations automatically. Is this possible?
My key questions are to
create a new tab with a template for each new data entry (results in a row in the data tab)
place entry-values to the tab to execute the calculations
I can also create many duplicate tabs of the template and place each answer to the specific cell manually, but I don't know how many entries there will be.
I have tried to create a new tab with new entries, but the tab is missing my template. I tried to link answers to specific cells, but did not know how.
If I understood correctly, you are using Google Forms to collect data and store the responses in a Google Sheet.
If that is correct, the best way to manage that input data adding calculations or other extra fields is to use a different tab.
F.e, if your form is collecting responses in tab "Form A", then you need to
Create another tab (let's say "curated A responses")
Import the data from "Form A" into the second tab
Add more fields, calculations, charts... whatever you need.
The simplest way to perform step 2 y using ='Form A'!A:A for column A and so on.
You write that into the first column of the second tab and it will populate existing and new values automatically.

Making updates to google forms

At present this is a hypothetical question and I haven't begun writing the code for this, mainly because I'm not sure if it is possible to achieve what I need to in Google Forms.
We have a employee contact form that is completed when they join the organisation, obviously people go through changes in life and either get a new mobile or change address, when this happens they change their contact details via a Google form, this adds a new row of data to the responses spreadsheet meaning that we have a duplicate entry for the same employee.
What I want to be able to do, is have the sheet look for duplicate data and overwrite the fields that have changed. I am fairly confident that this is possible, however, I am struggling with the logic.
If it is possible? Could you provide a hint as to how this might work.
It is possible to look for duplicates in a spreadsheet and delete them, however if you do it in the destination spreadsheet of a Google Form - the deleted duplicates will come back at every update.
So you need a workaround:
Create a new spreadsheet (slave) that will be synchronized with the destination spreadsheet (master) on every form submit
The form data from each form submit will be checked for duplicates before being written into the slave
You need a unique identifier, e.g. employee number
You can check either an entry with this identifier already exists in the slave, e.g. with indexOf()
If the identifier does not exist yet - append the new data to the last row of the slave
If the identifier exists already - find the row containing it and overwrite it with new data

Filling up a Form to update data table

I have to create a user-friendly form that allows employees to add details regarding a new shop branch to a data table, also in Access. Using only Microsoft Access, a user has to fill up a form with the relevant details so that a new entry will be appended to a data table.
E.g. A new shop branch will have the fields ShopID, ShopName, and PersonInCharge. Upon filling up a form with these 3 details, a user will click a button "Submit". Doing so will create a new entry in a data table.
I have tried linking the button to run a query that updates the data table but no new entries are created. I have also tried using the "Append" function as part of Query Design, but running it would append "0" rows.
Unfortunately I can't take any screenshots since I'm doing this in a company as part of my internship. This is my first time using Microsoft Access. Would appreciate the help!
In my understanding, you just want to make a simple form that simply add a record into your table right?
why don't you create a desired table first then create wizard form on it. It will automatically generate a form as needed then you can add a button using wizard choose categories -> record operations -> add new record.
Hope it helps!

Creating a data-entry Form with multitable Query

I have a form in my Access Database that is used for students to scan their badge and log in. If their badge hasn't been registered, the form just allows them to enter their information. I'm running into a problem where I'm using a Query that pulls their badge number from the previous form (which is inserted into a table temp) and compares it to the table with their information on it.
The problem I'm running into is that when I do this, I can't edit the information in the form, nor can I add more to entries, and when I separate the query and try to just pull from the table externally
(BadgeNumber = [temp]![T2])
it just pulls up a messagebox asking for the value.
Does anyone have any suggestions for accomplishing this?

Copy from Excel into Access using VBA -dynamic columns

I have an access database where users are supposed to copy from Excel and import into an Access table. The users can select from several "imports", and they can create new imports themselves. Once they have selected an import - a query is created on the fly with the required columns to be imported into the table. All imports will populate the same table, but not all columns are relevant for each import. So if Import1 is selected, then the query will display eg. column2, column3 and column4. If import2 is selected, then it could be column2 and column5 etc. Afterwards the import query is then deleted in the VBA code.
I am not sure this is the best solution to the problem, but in principle it works (however sometimes there may be problems deleting the queries if users exit the database before completing etc- so some manual removal of old queries may be required).
The problem is however that I need some columns to be completed with a predefined value set in the VBA code in addition to the data copied into the table by the user. An example of this could be that I need an ImportID column storing the ID of the import the user has selected for each row copied by the user. This needs to be done simultaneously as the user pastes data from Excel into the query. Otherwise I will not be able to identify the data in the table from other imports as required.
My only solution to this is to dynamically create a form (for each import that is requested), include the ImportID column in the form, set a predefined value for the Import column through VBA, lock the import column and then hide it in the form. That way, when the user pastes the data from Excel - the ImportID column is also populated with the correct value - without the user having to relate to that.
The issue is that I am worried this is a "messy" solution, creating multiple queries and forms in the database through VBA that need to be deleted - and I am sure a lot of them will be left as users will exit during the process before completing etc.
If anyone has a better approach to this, it will be much appreciated. I do need the imports to be done through copy/paste however (not reading files, although that could be an addition - it can not replace the current solution).
I’ll try to explain how the process works in more detail: First of all we have defined a «chart of accounts». Where let’s say account 4000-4100 is data from a CRM system. Account 5000-5100 is data from a payroll system. The user may then set up one import called «CRM import» requiring column 2, column3 and and column5 to be completed with accounts 4000-4100, and one import called «Payroll import» requiring column2, column3 and column7 to be completed with accounts 5000-5100.
When launching the «CRM» import – the VBA code simply opens a query created by VBA (DoCmd.OpenQuery) displaying column 2,3 and 5. In the Excel sheet – the user has the data on the same format. So the user then simply copies from the Excel sheet and pastes into the open Access query. Similarly when the user launches the «Payroll import», column2,3 and 7 are displayed in the VBA generated query. The user has another Excel sheet on this format to copy from as well. These are «power users» copying and pasting into the database – not just any users. All the data from the different sources are copied into the same access table in order to be processed later (so the queries simply display the relevant columns of the same table). Copy/paste from Excel is the preferred method of getting these data into Access for this solution.
Update 18th. March:
The issue I've still got is that I can not have one predefined form for each import. There can be multiple imports, imports may be deleted, added and modified by the user through the interface. So my idea is that when the user selects an import from a list, the form is opened (one form for all imports). And based on the import selected, the VBA code selects which columns should be displayed in the subform. Which columns two display, need to be checked each time an import is opened.
However if I do this in VBA, can two users open the same form at the same time (they work in the same access file) with two different imports and have different columns displayed ? Or do I need to create an instance of the form for each user, and then delete that instance when the user is done ? That doesn't seem like the best idea, but I'm not sure how to solve this.
If I understand the setup and the process users are following correctly, you have a master table to store all the various records users will copy and paste from CRM and payroll spreadsheet. For example a table like this:
You've then got separate CRM and Payroll queries, that simply show a different set of columns from the import table:
You've then got some form set up, which allows users to open the correct query:
..e.g. qryCRM:
..and copy/paste data from the relevant Excel spreadsheet:
I think you are going to have trouble trying to catch any user interaction with a query object as query objects, as far as I know, don't have many events to trigger VBA code from.
What I'd suggest doing is setting up a form with a subform for each of your CRM, payroll, etc imports.
The subform can then take your CRM and Payroll queries as a recordsource. For example, here's a subform using the query qryCRM as a recordsource:
...and if you also set the subform to a default view of "Datasheet"..
...users will be able to interact with the subform in a similar spreadsheet-style of the query object itself:
You can then set up your navigation form to point to the form rather than query:
Private Sub cmdImportCrm_Click()
DoCmd.OpenForm "frmCRM"
End Sub
You can now utilise a range of events on the subform to get additional data in to the dataset when the user pastes new records.
The best way I've found so far is to use the subform's BeforeInsert event:
This event is triggered each time a new record is added to the dataset, so if you paste 5 new rows, the event should trigger for each of those 5 rows.
For this event I simply specified that I wanted the ImportID column to get the text "CRM Import" (you can obviously specify something else):
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.ImportID = "CRM Import"
End Sub
So when we paste our data as new records, we also get the text we specified for the ImportID column as well:
Hope this helps :)