473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Too many fields for Excel

..NET 3.5

I am using OleDb and ADO.NET to insert data into Excel spreadsheet
everything works fine until I try to add a record with 256 fields, then I
get
"Too many fields defined." error.

How can I add 256 fields?
Here's my SQL statement.

"Insert Into [Sheet1$]
(F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F1 5,F16,F17,F18,F19,F20,F21,F22,F23,F24,F25,F26,F27, F28,F29,F30,F31,F32,F33,F34,F35,F36,F37,F38,F39,F4 0,F41,F42,F43,F44,F45,F46,F47,F48,F49,F50,F51,F52, F53,F54,F55,F56,F57,F58,F59,F60,F61,F62,F63,F64,F6 5,F66,F67,F68,F69,F70,F71,F72,F73,F74,F75,F76,F77, F78,F79,F80,F81,F82,F83,F84,F85,F86,F87,F88,F89,F9 0,F91,F92,F93,F94,F95,F96,F97,F98,F99,F100,F101,F1 02,F103,F104,F105,F106,F107,F108,F109,F110,F111,F1 12,F113,F114,F115,F116,F117,F118,F119,F120,F121,F1 22,F123,F124,F125,F126,F127,F128,F129,F130,F131,F1 32,F133,F134,F135,F136,F137,F138,F139,F140,F141,F1 42,F143,F144,F145,F146,F147,F148,F149,F150,F151,F1 52,F153,F154,F155,F156,F157,F158,F159,F160,F161,F1 62,F163,F164,F165,F166,F167,F168,F169,F170,F171,F1 72,F173,F174,F175,F176,F177,F178,F179,F180,F181,F1 82,F183,F184,F185,F186,F187,F188,F189,F190,F191,F1 92,F193,F194,F195,F196,F197,F198,F199,F200,F201,F2 02,F203,F204,F205,F206,F207,F208,F209,F210,F211,F2 12,F213,F214,F215,F216,F217,F218,F219,F220,F221,F2 22
,F223,F224,F225,F226,F227,F228,F229,F230,F231,F232 ,F233,F234,F235,F236,F237,F238,F239,F240,F241,F242 ,F243,F244,F245,F246,F247,F248,F249,F250,F251,F252 ,F253,F254,F255,F256)
Values
(62.94176,53.27762,47.59469,39.6018,27.39624,28.76 187,24.89748,24.65916,24.87506,22.36183,20.68387,2 1.11703,19.43238,19.95379,18.48395,18.05008,18.302 68,19.40492,22.124,20.33295,21.22496,23.34776,22.3 5655,19.55487,21.15947,20.70817,20.0374,20.19913,2 0.78927,19.69869,20.2163,21.15336,21.96335,22.9129 ,26.22494,22.88705,22.4422,19.76273,18.22623,17.76 345,18.53971,18.95599,18.90771,19.36051,21.41699,2 0.19919,21.34636,23.91522,24.80783,21.94726,22.459 45,22.737,25.95444,25.80054,20.25189,18.36274,16.7 9846,18.58291,22.29139,22.16352,21.41158,21.03988, 21.60466,22.71623,21.50996,21.03724,19.77541,19.97 819,20.54727,19.6565,18.75263,17.41543,17.64291,18 .33091,18.62344,19.85077,20.82256,21.28923,22.2090 7,22.72867,21.20162,20.77944,18.39044,19.23157,21. 69846,20.39108,17.80639,21.12927,20.98463,20.27427 ,21.17315,19.06533,18.29375,19.2694,19.18989,
18.83653,24.04533,23.51943,25.14662,23.43845,22.3, 21.04577,21.03441,20.68917,22.57755,20.87438,25.53 831,22.90078,21.26262,20.41783,20.46618,22.27405,1 9.86378,20.63409,20.22434,21.12482,20.82973,21.229 14,20.93445,25.31901,25.70027,27.84417,28.22738,31 .75908,38.27811,42.5686,39.16324,26.58023,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
"
Thank You

Peter
Oct 12 '08 #1
9 3174
Can you do something like

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

Then you can perform the update in more than 1 statement, each with less
than 256 fields specified.

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com

Oct 12 '08 #2

"Peter Morris" <mr*********@SPAMgmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Can you do something like

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

Then you can perform the update in more than 1 statement, each with less
than 256 fields specified.

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com
Unfortunately I need all 256 columns

I suppose I could do something like this, although it's not efficient and
kind of hokey, but I think it would work

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'
Oct 12 '08 #3
"Peter" <cz****@nospam.nospamwrote in message
news:OT**************@TK2MSFTNGP04.phx.gbl...
>
"Peter Morris" <mr*********@SPAMgmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Can you do something like

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

Then you can perform the update in more than 1 statement, each with less
than 256 fields specified.

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com

Unfortunately I need all 256 columns

I suppose I could do something like this, although it's not efficient and
kind of hokey, but I think it would work

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'

Excel 2003 and earlier is limited to 255 columns and 65,535 rows. If you
need more, you need to use excel 2007, which supports 16,384 columns and
1,048,576 rows. These are hard limits in Excel and you cannot create
individual spreadsheets larger than these limits.

Mike.
Oct 12 '08 #4
Unfortunately I need all 256 columns
>
I suppose I could do something like this, although it's not efficient and
kind of hokey, but I think it would work

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'
In what way is that not what I suggested? I fact, I think you may even have
copied and pasted my text :-)

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com

Oct 12 '08 #5

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam.wrote in message
news:38******************************@earthlink.co m...
"Peter" <cz****@nospam.nospamwrote in message
news:OT**************@TK2MSFTNGP04.phx.gbl...
>>
"Peter Morris" <mr*********@SPAMgmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Can you do something like

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

Then you can perform the update in more than 1 statement, each with less
than 256 fields specified.

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com

Unfortunately I need all 256 columns

I suppose I could do something like this, although it's not efficient and
kind of hokey, but I think it would work

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'

Excel 2003 and earlier is limited to 255 columns and 65,535 rows. If you
need more, you need to use excel 2007, which supports 16,384 columns and
1,048,576 rows. These are hard limits in Excel and you cannot create
individual spreadsheets larger than these limits.

Mike.

Is that limit on OleDb in Excel, because you when you open 2003 Excel there
are 256 columns not 255
Oct 12 '08 #6

"Peter Morris" <mr*********@SPAMgmail.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
>Unfortunately I need all 256 columns

I suppose I could do something like this, although it's not efficient and
kind of hokey, but I think it would work

insert into [sheet1$] (f1) values ('{a guid}');

update [Sheet1$] set F2 = 1231, F3 = 4234
where
F1 = '{a guid}'

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'

In what way is that not what I suggested? I fact, I think you may even
have copied and pasted my text :-)

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com
I need 256 columns, your sugestion took away one of the columns.
I did not use your code and claimed as my own, what I was saying was YES I
can do what you have suggested than just add the the additional Update, to
reclaim the first column. (Notice the 'set F1').

update [Sheet1$] set F1 = 2345
where
F1 = '{a guid}'

But this solution is not very efficient, 3 updates instead of 1.
Oct 12 '08 #7

"Peter" <cz****@nospam.nospamwrote in message
news:Oc**************@TK2MSFTNGP05.phx.gbl...
.NET 3.5

I am using OleDb and ADO.NET to insert data into Excel spreadsheet
everything works fine until I try to add a record with 256 fields, then I
get
"Too many fields defined." error.

How can I add 256 fields?
Here's my SQL statement.

"Insert Into [Sheet1$]
(F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F1 5,F16,F17,F18,F19,F20,F21,F22,F23,F24,F25,F26,F27, F28,F29,F30,F31,F32,F33,F34,F35,F36,F37,F38,F39,F4 0,F41,F42,F43,F44,F45,F46,F47,F48,F49,F50,F51,F52, F53,F54,F55,F56,F57,F58,F59,F60,F61,F62,F63,F64,F6 5,F66,F67,F68,F69,F70,F71,F72,F73,F74,F75,F76,F77, F78,F79,F80,F81,F82,F83,F84,F85,F86,F87,F88,F89,F9 0,F91,F92,F93,F94,F95,F96,F97,F98,F99,F100,F101,F1 02,F103,F104,F105,F106,F107,F108,F109,F110,F111,F1 12,F113,F114,F115,F116,F117,F118,F119,F120,F121,F1 22,F123,F124,F125,F126,F127,F128,F129,F130,F131,F1 32,F133,F134,F135,F136,F137,F138,F139,F140,F141,F1 42,F143,F144,F145,F146,F147,F148,F149,F150,F151,F1 52,F153,F154,F155,F156,F157,F158,F159,F160,F161,F1 62,F163,F164,F165,F166,F167,F168,F169,F170,F171,F1 72,F173,F174,F175,F176,F177,F178,F179,F180,F181,F1 82,F183,F184,F185,F186,F187,F188,F189,F190,F191,F1 92,F193,F194,F195,F196,F197,F198,F199,F200,F201,F2 02,F203,F204,F205,F206,F207,F208,F209,F210,F211,F2 12,F213,F214,F215,F216,F217,F218,F219,F220,F221,F2 22
,F223,F224,F225,F226,F227,F228,F229,F230,F231,F232 ,F233,F234,F235,F236,F237,F238,F239,F240,F241,F242 ,F243,F244,F245,F246,F247,F248,F249,F250,F251,F252 ,F253,F254,F255,F256)
Values
(62.94176,53.27762,47.59469,39.6018,27.39624,28.76 187,24.89748,24.65916,24.87506,22.36183,20.68387,2 1.11703,19.43238,19.95379,18.48395,18.05008,18.302 68,19.40492,22.124,20.33295,21.22496,23.34776,22.3 5655,19.55487,21.15947,20.70817,20.0374,20.19913,2 0.78927,19.69869,20.2163,21.15336,21.96335,22.9129 ,26.22494,22.88705,22.4422,19.76273,18.22623,17.76 345,18.53971,18.95599,18.90771,19.36051,21.41699,2 0.19919,21.34636,23.91522,24.80783,21.94726,22.459 45,22.737,25.95444,25.80054,20.25189,18.36274,16.7 9846,18.58291,22.29139,22.16352,21.41158,21.03988, 21.60466,22.71623,21.50996,21.03724,19.77541,19.97 819,20.54727,19.6565,18.75263,17.41543,17.64291,18 .33091,18.62344,19.85077,20.82256,21.28923,22.2090 7,22.72867,21.20162,20.77944,18.39044,19.23157,21. 69846,20.39108,17.80639,21.12927,20.98463,20.27427 ,21.17315,19.06533,18.29375,19.2694,19.18989,
18.83653,24.04533,23.51943,25.14662,23.43845,22.3, 21.04577,21.03441,20.68917,22.57755,20.87438,25.53 831,22.90078,21.26262,20.41783,20.46618,22.27405,1 9.86378,20.63409,20.22434,21.12482,20.82973,21.229 14,20.93445,25.31901,25.70027,27.84417,28.22738,31 .75908,38.27811,42.5686,39.16324,26.58023,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
"
Thank You

Peter

There's a 3rd party tool that works a lot better then OleDb, since you can
update any cell and it has no problem updating 256 columns.

http://www.tmssoftware.com/site/flexcel.asp
Oct 12 '08 #8
Good morning everyone.

I think the error "Too many fields defined" thrown by the statement:

"Insert Into [Sheet1$] (F1,F2,F3,F4,F5, ~ ,F255,F256) Values
(62.94176,53. ~ 0,0,0,0,0,0)"

is majorly caused by a limit of Microsoft Jet database engine:
http://support.microsoft.com/kb/199076
The Microsoft Jet database engine has an internal limit of 255 fields per
query. In other words, even if the client is upgraded to Excel 2007, the
error will still be thrown.

As the KB article documented, two workarounds are:
1. Break down the update query into multiple update/insert queries.
2. Update the fields by using a recordset in Visual Basic for Applications.

Apart from them, we may also consider Office automation in this Office
related issue. Office automation will allow us to automate Excel to add
values in the specified cell ranges. But it has two weaknesses: 1.
Performance; 2. The computer that runs the app needs to be installed with
Office.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 13 '08 #9

""Jialiang Ge [MSFT]"" <ji****@online.microsoft.comwrote in message
news:zu**************@TK2MSFTNGHUB02.phx.gbl...
Good morning everyone.

I think the error "Too many fields defined" thrown by the statement:

"Insert Into [Sheet1$] (F1,F2,F3,F4,F5, ~ ,F255,F256) Values
(62.94176,53. ~ 0,0,0,0,0,0)"

is majorly caused by a limit of Microsoft Jet database engine:
http://support.microsoft.com/kb/199076
The Microsoft Jet database engine has an internal limit of 255 fields per
query. In other words, even if the client is upgraded to Excel 2007, the
error will still be thrown.

As the KB article documented, two workarounds are:
1. Break down the update query into multiple update/insert queries.
2. Update the fields by using a recordset in Visual Basic for
Applications.

Apart from them, we may also consider Office automation in this Office
related issue. Office automation will allow us to automate Excel to add
values in the specified cell ranges. But it has two weaknesses: 1.
Performance; 2. The computer that runs the app needs to be installed with
Office.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
I can't use Automation because this program is part of ASP.NET project.

There's a 3rd party tool that works a lot better then OleDb, since you can
update any cell and it has no problem updating 256 columns and no Automation
needed.

http://www.tmssoftware.com/site/flexcel.asp
Oct 13 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Noesis Strategy | last post by:
I am attempting to build a database that profiles about 50 companies in a single industries. In a standard MS Word format, each profile would be about 20 pages of dense text and tables. In order...
1
by: Will | last post by:
1. I have a list of products in an excel spreadsheet, the fields are: Prefix, Stock Code, Suffix and Description. I want to import them into Access and then merge the 3 fields Prefix, Stock Code,...
2
by: ruthboaz | last post by:
Hi, I am exporting a table with data to an excel file.. Some fields are empty in the exported file while the others and the key field, has values. The empty field(s) in excel, will be entered...
3
by: parham1975 | last post by:
Is it possible to reverse the order of fields and records in Access? That is can I have fields displayed up-down in a table rather than as in the default view of left-right? It would make it...
3
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, At work, employees have been using a spreadsheet that I am trying to import into an access database to make some reports. The problem I'm having is that in the spreadsheet, they...
0
by: KNN | last post by:
I have created a report in access 2003 using a query. Used some of the fields to display under page header. Used others to display under group headers and used the remaining under detailed...
3
by: perryche | last post by:
All, In excel, when you find a field within a spreadsheet is wrong, and every row needs to be changed, you simply change one cell, copy that cell, and select all the rest of the cell, and paste...
2
by: Cara Murphy | last post by:
Hi There, I am hoping to be able to export a table from Access to Excel, however I would like to be able to select the fields that I want to export... For example, my Table has 23 fields, but...
0
by: bfrank1972 | last post by:
I want to be able to get a list of all custom named fields in an Excel worksheet, but I am having trouble with this. In the code below, access to a field that I named "DEALCODE" works fine - I get...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.