My Blog

Achieved 100k points in Stackoverflow

Received some goodies from stackoverflow on achieving 100k. I passed 100k rep on Stack Overflow on 28th June 2017 and received the “You’re killing it” email within 24 hours. Soon I received the swag form which I duly filled and submitted. I got a shipping notification on 7th July 2017 and DHL delivered the package today.

Read More

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
Page 1 of 1412345»10...Last »