My Blog

Open excel file and write some text to Excel File

In continuation from here… We created a file earlier here. Now we will try to open it and insert a record. The code is almost the same. Insert a button on your form and add 6 textboxes as shown in the image below. We will be accepting inputs and then insert those values into the text file. This is how …

Read More

Get column names from a specific sheet

In continuation from here… We created a file earlier here. To retrieve the column names, we store the data from the relevant sheet in a Datatable and then loop though it to get the column names. One thing to note here is that we are assuming that Row 1 is not empty and has column headers else we can’t use …

Read More

Add column to a sheet

In continuation from here… We created a file earlier here. Now we will try to add a new column to the existing data. Let’s say we want to add a column “Location”. One thing that we need to know that we cannot directly insert a column like we do in Interop. In Interop, it is pretty straightforward. While using OLEDB …

Read More

Retrieve worksheet names from excel file

In continuation from here… We created a file earlier here. Now we will try to retrieve the sheet names from that file. The code is pretty straight forward. The below code can also be converted to a function to return an array of sheet names

Read More

Export data from DataGridView to excel file

In continuation from here… Add a DataGridView and a Button. Let’s say your form looks like as shown below Now we will create a sample data in the form’s load event. When you run the form, it look like this Now in the Button’s code, put this When you click on the button, the a new excel file “C:\Temp\ExportedData.Xlsx” is …

Read More

Import data from excel file to DataGridView

In continuation from here… We created a file earlier here. Now let’s try and import the data into a DataGridView. In your form, add a DataGridView and also add a button as shown in the image below. What we will do is ask user to select the excel file and then we will import the data from Sheet1 into a …

Read More
Page 1 of 1412345»10...Last »