B
bullpit
Hi,
I found several examples to write into an existing excel file. I can write
in to a particular cell by using something like this:
Code Snippet
m_objRange = m_objSheet.get_Range("A1", m_objOpt);
m_objRange.set_Value(m_objOpt, "Last Name");
The problem is that I have a lot of cells that need to be manipulated. So I
tried to use OleDB for that and could write a query like this:
Code Snippet
objCmd.CommandText = "Insert into [Sheet1$] ([First Name], [Last Name])" +
" values ('Bill', 'Brown')";
objCmd.ExecuteNonQuery();
This works too, but only if I just have a flat table structure. The file I
have to modify has a header type thingy (which has company name that spawn
thru several cells, and some other information). How can I skip the initial
cells which comprise of the header and then start writing from the actual
table cells.
The query method shown above gives error that it cannot find the table name
Sheet$ if I include the header.
Thanks
I found several examples to write into an existing excel file. I can write
in to a particular cell by using something like this:
Code Snippet
m_objRange = m_objSheet.get_Range("A1", m_objOpt);
m_objRange.set_Value(m_objOpt, "Last Name");
The problem is that I have a lot of cells that need to be manipulated. So I
tried to use OleDB for that and could write a query like this:
Code Snippet
objCmd.CommandText = "Insert into [Sheet1$] ([First Name], [Last Name])" +
" values ('Bill', 'Brown')";
objCmd.ExecuteNonQuery();
This works too, but only if I just have a flat table structure. The file I
have to modify has a header type thingy (which has company name that spawn
thru several cells, and some other information). How can I skip the initial
cells which comprise of the header and then start writing from the actual
table cells.
The query method shown above gives error that it cannot find the table name
Sheet$ if I include the header.
Thanks