Sep 06, 2024 07:36 AM
Hello!
I am appreciative of any help on this one! I have spend way to many hours of Youtube trying to figure this out.
Problem: Cannot import a CSV file to a synced table
Scenario: I have a new table that is synced to another base (that part is working perfectly!), but when I try to build out the new table it will not allow me to upload a CSV because the table is being synced. I have 450 columns (fields) that I need to add that have already been mapped out in an excel file. I would LOVE to save hours of manually creating each field and have it upload into the synced file. I'm not worried about it updating the records (rows), I really just don't want to have to manually add each column.
Is there any other workaround I can try?!
Sep 06, 2024 07:19 PM
Perhaps try looking into scripting? You'd retrieve all the fields and then create them programatically
I take it you're trying to create all the fields in the main table and upload the CSV there, and then have it sync over to the synced table in the other base?
Sep 07, 2024 10:32 AM
Hi,
You can use this very simple script, but it has 2 disadvantages: it creates only fields of the same type, it creates them one-by-one, with approximately 2 fields/sec, so you have to wait 3-4 minutes for all.
let table=base.getTable('Table_1')
let newFields=['Field 1','Second field','And so on']
while(newFields.length) await table.createFieldAsync(newFields.shift(),'singleLineText')
ensure you filled newFields=['....] correct, without empty strings, repeats etc.
ignore linter warning under newfields.shift()
But I would recommend NO-CODE and simple way.
To create a number of fields in bulk, you have to create a new table will all fields together, or you have to import data.
You can't import into synced table, but you do a simple join by paste.
- ensure you have no matching names in the current synced table and new fields to be created.
- create a new table with all your fields by importing CSV
- select first row, press Control+C
(it should react like "450 cells copied")
- switch to your synced table, scroll right to the end, create new field with the name matching first name of your selected fields (I mean in the table you imported from CSV)
- put mouse cursor in the cell, click on it. then press Ctrl+V to paste
If it's OK it will ask you to add more fields. formula fields will be added as text with their values. I guess, some fields like links, lookups will be added as text too.