I've created a map with lots of layers and info box info and sql codes, but now I need to use a different dataset from the one I was originally using. Is there a quick way to just swap out the dataset (all the fields are the same)? I haven't been able to find it on any of the documentations on Cartodb.

1 Answer 1


There's no official way to do this, but there's a trick you can use.

Add the new dataset you want to use as a new layer. If you need to copy the styles of the previous dataset, you can just copy and paste pretty easily in this view.

Now, delete the old dataset layer. This will just leave a single layer with your new data, and any changes you have made to the map itself such as adding elements, configurations, or metadata will remain. Also, with this approach you still have the same map with the same map id, so if you shared it already it will continue working!

You could also change the SQL query in your current layer to point to the new dataset, but this could point to confusions in the future and perhaps you can end up deleting something you don't want to. :-)

  • I thought about doing that, but then I was worried about other links the map may have with the old dataset, since I'm not sure in the backend what's linked and not linked? Sorry for the late response. When I clicked on my profile, it said 0 answers to my question! Thank you for your help!
    – Emily
    Mar 10, 2016 at 0:53
  • When you work inside the same map the ID of it doesn't change, so the links won't change. The old links that you might have shared will point to a specific map, and the layers that you have or don't have in your map are independent of that :-) You can always do a small test with another map if you want to be sure that you understand the behaviour.
    – iriberri
    Mar 10, 2016 at 8:25
  • I have the same issue; a dataset in a map which I would like to be able to update weekly without having to re-set the zoom-level opacity for labels or fills/lines and custom HTML colours outside of the ones in the CartDB colour picker. I have found that I can copy the customized CSS html and paste it into the new layer, but some things don't seem to take. a "replace dataset" button in the datasets window which retains links to maps using that dataset would be a great feature for CartoDB to add!
    – user25644
    Jun 1, 2016 at 21:30
  • Copying the CartoCSS, even though it might seem that the CartoCSS contains the names of the tables to render won't switch the table. You can change the SQL of your layer for it to get the information from other table. By default, the query would be SELECT * FROM your_old_table, but you can change it by SELECT * FROM your_new_table. As far as the columns and types match, the map will keep working with your current styles. Otherwise, unexisting columns or types that don't match with your old data might break your styles.
    – iriberri
    Jun 2, 2016 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.