Export to import-able format #7653
Replies: 8 comments 2 replies
-
I stumbled across this too and wonder whats the reason behind this. Why export something that isnt importable directly again :D |
Beta Was this translation helpful? Give feedback.
-
in the same vein, it'd also be nice if the import function could update existing objects instead of just add new ones |
Beta Was this translation helpful? Give feedback.
-
Hi, also struggling with this, I saw that export templates can be a way forward. So I tried creating one for cables and almost got it solved. This will show as an option when you click the export button. Go to: https://[[YourURL]]/admin/extras/exporttemplate/ add and then something like this for cables: label,type,color,side_a_device,side_a_name,side_a_type,side_b_device,side_b_name,side_b_type The problem I am having is that cables.termination_a_type & cables.termination_b_type is returning; Are there some suggestion on how to change the code to give the later result? EDIT: label,type,color,side_a_device,side_a_name,side_a_type,side_b_device,side_b_name,side_b_type |
Beta Was this translation helpful? Give feedback.
-
These are jinja template variables, right, so should you be able to
{{ cables.termination_b_type.replace(' | ', '.') }}
or something like that (didn't go look up the filter manual to check my scribblings)
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: oneone84 ***@***.***>
Sent: Friday, May 6, 2022 1:38 AM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [netbox-community/netbox] Export to import-able format (Discussion #7653)
Hi, also struggling with this, I saw that export templates can be a way forward. So I tried creating one for cables and almost got it solved. This will show as an option when you click the export button.
Go to: https://[[YourURL]]/admin/extras/exporttemplate/
add and then something like this for cables:
label,type,color,side_a_device,side_a_name,side_a_type,side_b_device,side_b_name,side_b_type
{% for cables in queryset %}
{{ cables.label }},{{ cables.type }},{{ cables.color }},{{ cables.termination_a.device.name }},{{ cables.termination_a }},{{ cables.termination_a_type }},{{ cables.termination_b.device.name }},{{ cables.termination_b }},{{ cables.termination_b_type }}
{% endfor %}
The problem I am having is that cables.termination_a_type & cables.termination_b_type is returning;
dcim | interface
instead of
dcim.interface
Are there some suggestion on how to change the code to give the later result?
—
Reply to this email directly, view it on GitHub<#7653 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UMZPTW2PDGH3VXXVUV3VIS45VANCNFSM5G2H65HQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I am looking to export all the assets to a csv file. Is there a way to do that. I'm currently running 2.10.6 version of Netbox. |
Beta Was this translation helpful? Give feedback.
-
I just started using netbox version 3.6.2, and it seems similar here. Exporting a list of virtual machines to CSV requires manual edits on column names and values to allow imports. |
Beta Was this translation helpful? Give feedback.
-
"It's a feature, not a bug." Seriously, the export was designed to have human-readable column names. The import needs the column names to match the internal field names. It's documented, but not very well. |
Beta Was this translation helpful? Give feedback.
-
I, at least, have been wishing for this function for several years. I once opened a feature request for it. As I haven't found anything about it yet. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
The way we are using Netbox here implies creating objects in the tool before changes are implemented in production. This often means creating whole swaths of objects, very similar to existing ones (e.g. IP addresses, virtual interfaces...). The easiest way to do that is to export the existing data, manipulate them in bulk in some spreadsheet and then reimport it.
Unfortunately, this is made difficult by the fact that -1- the exported data contains display values for the column name and attribute values, and -2- there is no easy way to export all and only the columns used in import. When I do that, I need to rename all columns (mostly de-capitalizing the first letter) and change all pretty values for ones that can be improted back (again decapitalizing, or changing the whole word). It is a pain, even if it is still faster than creating all objects from scratch.
What about having a predefined format, in the export dialog, that would export as many columns as possible but only taken among those available for import, and that would use the same column name and values as parsed during import?
Best regards,
Xavier Lagraula
Beta Was this translation helpful? Give feedback.
All reactions