Import Excel Data programmatically to access table with column mapping - ms-access

I am in search of a tool / VBA code snippet that can port my excel data to my access table with effective columns mapping. Anybody please share if you have any idea on these.
Thanks in advance

The standard way to import or link Excel in Access is to use the TransferSpreadsheet method of the DoCmd object. The link is for 2007, but it has been available certainly since 2000, if not before. TransferSpreadsheet includes a HasFieldNames argument.

In Access 2007 you can use External Data/Import/Excel
Just follow the wizard to select the workbook, type of connection, sheet and data.
Data can be imported to a new table, appended to an existing table, or as a linked table
In Access 2003 its File/Get External Data/Import or File/Get External Data/Link tables
select file type .xls and browse to the workbook

if this task is something that u need to perform on a regular basis, you may want to consider creating a macro and scheduled task to perform this automatically. it is very easy to settup and I can outline procedure if need be

Related

How to import data from external webpage connection in MS Access like excel has Data- WebPage

Like excel has Data=>From Web to import a table in webpage in excel. How can I achieve this in MS Access? I want to data in table in external web page into the MS Access Table. Just Like we can in excel.
I don't want to use any intermediate excel to import data in Access but direct
external html page data into Access.
I want to import the option chain from NSE India into MS Access.
The external webdata is Option chain from NSE india like in URL:
https://nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-10003&symbol=NIFTY&symbol=NIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17
This was done in Excel but I want to do it in MS Access.
There is no easy way to do this; Access can get the table from the downloaded file, but it will be confused by the double-line headers. It can ignore one line but not two, thus the headers' second line will be read as data scrambling the real data.
Excel just does a better job isolating the table with its headers and values. Your best option, in my opinion, will be to automate Excel, using it to retrieve the page and build the table. Then, from Access, link the prepared worksheet holding the table.
Alternatively, use the function DownloadFile found in my project at GitHub: VBA.PictureUrl, link the file, and create a query (using the linked file as source) where you clean up and convert the retrieved data as needed.

How can I update LibreOffice Calc cells in real-time from a MySQL database?

I'm looking to write a program to update cells in LibreOffice Calc in real-time (or at least at some fixed tick) with data pulled from a MySQL database. Ideally, when the values in the database are updated, the corresponding cells in the spreadsheet would be updated such that any formulas or calculations existing in calc would continue to operate on the new values. So far, I have yet to find a way to dynamically and programatically insert data in this manner. Is it possible?
The LibreOffice component Base is a database front-end that handles queries, forms, and reports. While by default it uses an embedded version of HyperSQL database to manage the tables, it comes with drivers for any number of other back-end programs, including MySQL.
I think the easiest way to approach this would be to create a Base file with your MySQL database as its back-end (note Base will only be able to see tables and views from MySQL - it won't import queries; although you can save queries in the Base file if you want). Make sure to 'register' the Base file so the rest of LibreOffice can 'see' it. Once the file is registered, any open LibreOffice component can access the data from MySQL (Base file can be closed).
Now you can import any tables or views (from the MySQL component) or queries (from the Base file) into Calc: [Tutorial] Using registered datasources in Calc
Refreshing the imported data can be done through an API call. Here is an example in StarBasic code:
Sub refresh_DBRanges
Dim oDBRangesEnum
Dim oNext
oDBRangesEnum = thisComponent.DatabaseRanges.createEnumeration()
while oDBRangesEnum.hasMoreElements()
oNext = oDBRangesEnum.nextElement()
oNext.refresh()
wend
End Sub
Note in the second posting of the 'registered data sources' tutorial, it gives the API call to set the import ranges on a refresh timer.
Just a note that the Registered DataSources Tutorial is updated further down its page. It says the list of registered data sources can be accessed by hitting F4. That was true once but was changed with version 5. It's now Ctrl+Shft+F4.

Temporarily disable MS Access data macros

I have several Access files with data from a group of users that I'm importing into one master file. The tables in the user files are each configured with a Before Change data macro that adds a timestamp each time the user edits the data.
("Data macros" are similar to triggers in SQL Server. They are different from UI macros. For more info, see this page.)
I'd like to import these timestamps into the master file, but since the master file is a clone of the user files, it also contains the same set of data macros. Thus, when I import the data, the timestamps get changed to the time of the import, which is unhelpful.
The only way I can find to edit data macros is by opening each table in Design View and then using the Ribbon to change the settings. There must be an easier way.
I'm using VBA code to perform the merge, and I'm wondering if I can also use it to temporarily disable the data macro feature until the merge has been completed. If there is another way to turn the data macros off for all files/tables at once, even on the users' files/tables, I'd be open to that too.
Disable the code? No. Bypass the code? Yes.
Use a table/field as a flag. Set the status before importing. Check the status of this flag in your event code, and decide if you want to skip the rest of the code. I.e.
If [tblSkipFlag].[SkipFlag] = false
{rest of data macros}
EndIf
Another answer here explains how you can use the (almost-)undocumented SaveAsText and LoadFromText methods with the acTableDataMacro argument to save and retrieve the Data Macros to a text file in XML format. If you were to save the Data Macro XML text for each table, replace ...
<DataMacro Event="BeforeChange"><Statements>
... with ...
<DataMacro Event="BeforeChange"><Statements><Action Name="StopMacro"/>
... and then write the updated macros back to the table then that would presumably have the effect of "short-circuiting" those macros.

How can I go throught every tab in Excel file to evaluate header value in SSIS

I've a SSIS solution to import data from Excel file to SQl Server table.
But the Excel file have differents tabs and I need to go for each one evaluating the header value for A1 cell, if it's for sample "Appointment Count", that is the tab I have to imported.
some idea how can I do it?
thanks
Eliana
You can create an OLEDB connection manager, using the Microsoft Jet Provider to open the Excel file. From there, you can create a For Each loop container to iterate through the worksheets therein.
For an example of how to implement this, check here.
*Remember that the MS Jet provider is available in 32-bit only.

How to extract data from excel file into the database in Mysql at runtime in asp.net?

I am creating a website...and i want to give a liberty to users, to upload the data of excel file and then i want to save that excel data inside mysql database on runtime...
kindly help me in performing this task...
you can mail me at...."amiteshsinha09#rediffmail.com"
thank you
Amitesh
You can query the data in the excel sheet using Open Xml
Using this instead of running Excel via interop is both faster, more stable and saves you licence costs.