Forum Discussion
Create SPO list from csv with schema with calculated columns
Hi,
I am trying to create a new SPO list from csv with schema. (I take the standard route: New, List, CSV. Then upload the csv file from my pc.)
In general it is working ok, but I am unable to process calculated columns correctly. The column is imported, but as values rather than a formula. Here is an example of a column-definition from my schema (I have omitted various other columns which are unproblematic):
ListSchema= { "schemaXmlList": [
"<Field Type=\"Calculated\" DisplayName=\"ProgrammeID_Space_ProgrammeName\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" Format=\"DateOnly\" LCID=\"2057\" ResultType=\"Text\" ReadOnly=\"TRUE\" ID=\"{65de5fda-ea99-4829-ae88-c71d6d1cb2e0}\" StaticName=\"ProgrammeID_Space_ProgrammeName\" Name=\"ProgrammeID_Space_ProgrammeName\"><Formula>=ProgrammeID&\": \"& Programme</Formula><FieldRefs><FieldRef Name=\"Programme\" /><FieldRef Name=\"ProgrammeID\" /></FieldRefs></Field>"
]}
All the formula does is produce a text column consisting of ProgrammeID & " " & ProgrammeName so nothing complicated.
Can anyone suggest how to resolve this issue, please?
Thanks, Andrew
PS Why does the schema have Format=\"DateOnly\" when this field has nothing to do with dates?
CSV import doesn't support formula logic: When you upload a CSV to create a list, SharePoint treats all columns as static data. Even if you include schema XML, calculated fields are not parsed as formulas — only their current values are imported.
Calculated fields require manual creation: SharePoint needs you to define calculated columns directly in the list settings or via PowerShell/REST API — not via CSV.
2 Replies
- PankajBadoniIron Contributor
CSV import doesn't support formula logic: When you upload a CSV to create a list, SharePoint treats all columns as static data. Even if you include schema XML, calculated fields are not parsed as formulas — only their current values are imported.
Calculated fields require manual creation: SharePoint needs you to define calculated columns directly in the list settings or via PowerShell/REST API — not via CSV.- AndrewCromptonCopper Contributor
Hi, Pankaj
Thanks for this. Looks like I'll have to deal with the calculated fields manually, then. Maybe MS will get around to parsing such fields as formulas at some point - would be useful.
Andrew