vzhd1701 / csv2notion Goto Github PK
View Code? Open in Web Editor NEWImport/Merge CSV files into Notion database
License: MIT License
Import/Merge CSV files into Notion database
License: MIT License
Hi! Project seems great, but is it possible to use it as an importable python library?
0.3.8
Windows
Windows 11
After uploading my data from my CSVs to a database in notion, trying to duplicate (ctrl + D or pressing the 3 dots and pressing duplicate) doesn't seem to do anything, or it's creating them somewhere in the void. if I create a new item in the database from notion, I can duplicate it. Only the ones uploaded via the csv2notion tool can't be duplicated. Thanks!
No response
0.3.7
Windows
Win11 22H2 22621.963
I use
csv2notion --token [my_token] --url [my_url] --icon-column icon_url --icon-column-keep --merge --randomize-select-colors [file].csv
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\csv2notion.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\csv2notion\cli.py", line 82, in main
cli(*sys.argv[1:])
File "C:\Python311\Lib\site-packages\csv2notion\cli.py", line 31, in cli
client = get_notion_client(
^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\csv2notion\notion_db.py", line 204, in get_notion_client
client = NotionClientExtended(token_v2=token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\csv2notion\notion_db_client.py", line 23, in __init__
super().__init__(*args, **kwargs)
File "C:\Python311\Lib\site-packages\notion\client.py", line 88, in __init__
self.session = create_session(client_specified_retry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\notion\client.py", line 47, in create_session
retry = Retry(
^^^^^^
TypeError: Retry.__init__() got an unexpected keyword argument 'allowed_methods'
Could it be possible to delete notion's rows that are not on the new csv files to keep the db updated ?
On notion db:
a
b
c
The new csv file contains:
a
c
Then after the merge function, notion's db should be updated like this:
a
c
csv2notion 0.3.0
MacOS
macOS 12.4
Simply executing ./csv2notion --version
is slow to execute - it takes around 7sec on my machine.
Is there any reason for this? I'd expect it to be instant, given it's just returning a baked in version number?
No response
csv2notion 0.3.0
MacOS
macOS 12.4
Error when attempting to do:
./csv2notion --token "xxx" --image-column "Image Filename" --image-column-keep --mandatory-column "Shot ID" --image-caption-column "Scene Description" --max-threads 5 --merge --log ~/Desktop/uploadlog.txt --verbose test.csv
./csv2notion --token "xxx" --max-threads 5 --merge --log ~/Desktop/uploadlog.txt --verbose test.csv
./csv2notion --token "xxx" --log ~/Desktop/uploadlog.txt --verbose test.csv
CSV Data:
Shot ID,Shot Number,Scene Location,Shot Duration,Scene Number,Scene Prefix,Scene Time,Scene Time Range,Scene Set,Script Page No.,Scene Characters,Scene Cast,Scene Description,Shot Size & Type,Camera Movement,Camera Angle,Equipment,Lens,Lighting Notes,VFX,VFX Description,SFX,SFX Description,Music Track,Production Design,Props,Props Notes,Wardrobe ID,Wardrobe Notes,Hair,Make Up,Flag,User Notes 1,User Notes 2,Start Date,End Date,Days,Image Filename
001-1,1,Location Address,00:00:05,001,INT,Dawn,Scene Time Range,Set ID,1,Scene Characters,Scene Cast,Scene Description,WS,Camera Movement,Eye Line,Equipment,Focal length,Lighting Notes,false,VFX Description,false,SFX Description,Music Track,Production Design,Props ID,Props Notes,Wardrobe ID,Wardrobe Notes,Hair,Make Up,false,User Notes 1,User Notes 2,Start Date,End Date,Days,,
001-2,2,Location Address,00:00:05,001,INT,Dawn,Scene Time Range,Set ID,1,Scene Characters,Scene Cast,Scene Description,WS,Camera Movement,Eye Line,Equipment,Focal length,Lighting Notes,false,VFX Description,false,SFX Description,Music Track,Production Design,Props ID,Props Notes,Wardrobe ID,Wardrobe Notes,Hair,Make Up,false,User Notes 1,User Notes 2,Start Date,End Date,Days,,
INFO: Validating CSV & Notion DB schema
Traceback (most recent call last):
File "csv2notion/__main__.py", line 4, in <module>
File "csv2notion/cli.py", line 82, in main
File "csv2notion/cli.py", line 24, in cli
File "csv2notion/csv_data.py", line 43, in __init__
File "csv2notion/csv_data.py", line 75, in _column_types
File "csv2notion/csv_data.py", line 76, in <dictcomp>
File "csv2notion/notion_type_guess.py", line 7, in guess_type_by_values
TypeError: unhashable type: 'list'
[14671] Failed to execute script '__main__' due to unhandled exception!
INFO: Validating CSV & Notion DB schema
Traceback (most recent call last):
File "csv2notion/__main__.py", line 4, in <module>
File "csv2notion/cli.py", line 82, in main
File "csv2notion/cli.py", line 24, in cli
File "csv2notion/csv_data.py", line 43, in __init__
File "csv2notion/csv_data.py", line 75, in _column_types
File "csv2notion/csv_data.py", line 76, in <dictcomp>
File "csv2notion/notion_type_guess.py", line 7, in guess_type_by_values
TypeError: unhashable type: 'list'
[14770] Failed to execute script '__main__' due to unhandled exception!
INFO: Validating CSV & Notion DB schema
Traceback (most recent call last):
File "csv2notion/__main__.py", line 4, in <module>
File "csv2notion/cli.py", line 82, in main
File "csv2notion/cli.py", line 24, in cli
File "csv2notion/csv_data.py", line 43, in __init__
File "csv2notion/csv_data.py", line 75, in _column_types
File "csv2notion/csv_data.py", line 76, in <dictcomp>
File "csv2notion/notion_type_guess.py", line 7, in guess_type_by_values
TypeError: unhashable type: 'list'
[14810] Failed to execute script '__main__' due to unhandled exception!
csv2notion 0.3.9
Windows
11
I am getting this issue-> CRITICAL: Invalid Notion token, even though the secret token does work with other programs.
Any help would be great :)
csv2notion --token secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx test.csv
INFO: Validating CSV & Notion DB schema
CRITICAL: Invalid Notion token
0.3.6.
Linux
Ubuntu 22.04.1 LTS
I use
poetry run csv2notion --token [here] --url "[here]" --merge [file].csv
and it gives me this traceback (in the log)
I already used csv2notion 2 weeks ago with the same command and it worked perfectly so I don't know what happened.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/lognece/csv2notion/csv2notion/cli.py", line 82, in main
cli(*sys.argv[1:])
File "/home/lognece/csv2notion/csv2notion/cli.py", line 31, in cli
client = get_notion_client(
File "/home/lognece/csv2notion/csv2notion/notion_db.py", line 201, in get_notion_client
client = NotionClientExtended(token_v2=token)
File "/home/lognece/csv2notion/csv2notion/notion_db_client.py", line 23, in __init__
super().__init__(*args, **kwargs)
File "/home/lognece/.cache/pypoetry/virtualenvs/csv2notion-1cy6-Njf-py3.10/lib/python3.10/site-packages/notion/client.py", line 113, in __init__
self._update_user_info()
File "/home/lognece/.cache/pypoetry/virtualenvs/csv2notion-1cy6-Njf-py3.10/lib/python3.10/site-packages/notion/client.py", line 145, in _update_user_info
if not records["space"]:
KeyError: 'space'
Expose notion database operations as a python code API
csv2notion 0.3.7
Linux
Ubuntu 22.04.1 LTS
Hi, I'm trying to create a database from a CSV file with the following command:
csv2notion --token $notion_token --column-types "text,text,text,text,text,text,text,text,number,number,text,text,text,text,text,text,text,text,text,number,date,number,number,number,number,number,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text" $csv_file
But I'm facing the error:
requests.exceptions.HTTPError: Unsaved transactions: User does not have edit access to record
Although it clearly shows me that my user does not have permission to proceed, I'm not sure what I should do to overcome it.
Any thoughts on how to proceed? Thanks in advance :)
PS1: I've copied $notion_token
following the suggested tutorial: https://vzhd1701.notion.site/Find-Your-Notion-Token-5f57951434c1414d84ac72f88226eede
PS2: Removing --column-types "text,text,text,text,text,text,text,text,number,number,text,text,text,text,text,text,text,text,text,number,date,number,number,number,number,number,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text"
to simplify the command does not make any difference, still having the same error.
INFO: Validating CSV & Notion DB schema
INFO: Creating new database
ERROR: Got 400 error attempting to POST to submitTransaction, with data: {
"operations": [
{
"id": "f89ea9df-5bb8-4bf8-b0dd-f3d46b9ffd98",
"path": [],
"args": {
"id": "f89ea9df-5bb8-4bf8-b0dd-f3d46b9ffd98",
"version": 1,
"alive": true,
"created_by_id": "f45d138d-e616-4ea8-839e-b2416b55be67",
"created_by_table": "notion_user",
"created_time": 1676905261745,
"parent_id": "f404e73e-8425-4264-9e99-236bbfc6e4d4",
"parent_table": "space",
"space_id": "f404e73e-8425-4264-9e99-236bbfc6e4d4",
"type": "collection_view_page",
"permissions": [
{
"role": "editor",
"type": "user_permission",
"user_id": "f45d138d-e616-4ea8-839e-b2416b55be67"
}
]
},
"command": "set",
"table": "block"
},
{
"args": {
"last_edited_by_id": "f45d138d-e616-4ea8-839e-b2416b55be67",
"last_edited_by_table": "notion_user",
"last_edited_time": 1676905261745
},
"command": "update",
"id": "f89ea9df-5bb8-4bf8-b0dd-f3d46b9ffd98",
"path": [],
"table": "block"
},
{
"id": "f404e73e-8425-4264-9e99-236bbfc6e4d4",
"path": [
"pages"
],
"args": {
"id": "f89ea9df-5bb8-4bf8-b0dd-f3d46b9ffd98"
},
"command": "listAfter",
"table": "space"
},
{
"args": {
"last_edited_by_id": "f45d138d-e616-4ea8-839e-b2416b55be67",
"last_edited_by_table": "notion_user",
"last_edited_time": 1676905261745
},
"command": "update",
"id": "f89ea9df-5bb8-4bf8-b0dd-f3d46b9ffd98",
"path": [],
"table": "block"
}
]
}
Traceback (most recent call last):
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/bin/csv2notion", line 8, in <module>
sys.exit(main())
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/csv2notion/cli.py", line 82, in main
cli(*sys.argv[1:])
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/csv2notion/cli.py", line 39, in cli
collection_id = new_database(args, client, csv_data)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/csv2notion/cli_steps.py", line 33, in new_database
url, collection_id = notion_db_from_csv(
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/csv2notion/notion_db.py", line 142, in notion_db_from_csv
page_id = client.create_record(
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/notion/client.py", line 417, in create_record
with self.as_atomic_transaction():
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/notion/client.py", line 469, in __exit__
self.client.submit_transaction(operations)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/notion/client.py", line 323, in submit_transaction
self.post("submitTransaction", data)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/ratelimit/decorators.py", line 113, in wrapper
return func(*args, **kargs)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/ratelimit/decorators.py", line 80, in wrapper
return func(*args, **kargs)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/notion/client.py", line 275, in post
return self._post(endpoint, data)
File "/home/joaoferreira/miniconda3/envs/csv2notion_env/lib/python3.10/site-packages/notion/client.py", line 290, in _post
raise HTTPError(
requests.exceptions.HTTPError: Unsaved transactions: User does not have edit access to record
0.3.7
MacOS
Ventura 13.2.1
For quite some time I've been using csv2notion without any issues.
Suddenly (starting May2) I started receiving CRITICAL: Invalid Notion token
error message whenever I try to import my file. This started happening with the token that I previously used without any issue.
I've tried generating new tokens, with different browsers and tried running script on different devices - without any success. The package is installed via homebrew, so I tried updating it - also no help at all, just stuck on the same error for few days already.
I use Google login to log in to Notion, so not sure if that affects it somehow, but the way I log in hasn't changed since I started using csv2notion. Tried to find anyone with the issue that I face but I see posts on Reddit over a year old that actually don't apply anymore.
Am I just out of luck or there actually is an issue?
csv2notion --token **mytokenhere** --url "myurlhere" import.csv
INFO: Validating CSV & Notion DB schema
CRITICAL: Invalid Notion token
I wouid like to be able to do joins on fields with multi-word text contents, like "first_name last_name". It seems to work fine when there are no spaces in the text, but will always create new entries if there are multple words.
Where in the code would I find the place to start looking at that?
0.3.8
MacOS
macOS Monterey 12.6.9
@vzhd1701 I believe with the recent changes of Notion APIs, batch uploading of Icon Image is broken. Hope you can resolve and fix it soon. Thank you.
2023-09-21 10:06:33,352 [INFO ] Validating CSV & Notion DB schema
2023-09-21 10:06:34,221 [INFO ] Uploading Marker Data Demo_V1.csv...
2023-09-21 10:06:50,153 [CRITICAL] Could not upload file /Users/XXX/Desktop/ZZZ/App/0.2.0/marker-chapter.png
csv2notion 0.3.0
MacOS
macOS 12.4
csv2notion doesn't seem to like the ⛔ emoji?
./csv2notion --token "XXX" --default-icon "⛔"️ --verbose xxx.csv
File not found: ⛔️
0.3.8
MacOS
macOS Monterey 12.6.9
@vzhd1701 Along with batch uploading of Icon Image, batch uploading of images from CSV is also broken. Hope this can be resolved and fixed too. Thank you.
2023-09-21 10:14:35,115 [INFO ] Validating CSV & Notion DB schema
2023-09-21 10:14:36,224 [WARNING ] CSV columns missing from Notion DB: {'Icon Image'}
2023-09-21 10:14:36,226 [INFO ] Uploading Marker Data Demo_V1.csv...
2023-09-21 10:15:18,575 [CRITICAL] Could not upload file Could not upload file /Users/XXX/Desktop/ZZZ/App/0.2.0/Image_01.png
Would this be possible with minimal work?
0.3.8
MacOS
mac os ventura 13.2.1
I'm unable to upload any csv files with image data. I want to upload local image file to notion db. All other columns seem to be uploaded except for the image data.
INFO: Validating CSV & Notion DB schema
INFO: Uploading batch_1_output.csv...
CRITICAL: Could not upload file /Users/..../path../main.jpg
It is possible to add a parameter to indicate to a column or to all multi-select columns in general whether to add new values and not replace those that already had. For example, I have a multi-select column with categories and for an existing record that already has the categories 'planned, home', when I want to update that existing row "merge" with the label next, it replaces 'planned, home' with 'next' and what I was looking for was 'planned, home, next'.
By default, the key (name) column is the first column.
Add an argument that allow a specific column to be the key column instead.
0.3.5
MacOS
12.5.1. Installed using brew.
Hi,
I can't seem to get this work as I keep getting the same CRITICAL: Provided URL links does not point to a Notion database.
error.
I'm sure I'm copying the proper view link using the table options (as displayed in README's example). Did something change in the API? I'm pretty sure I'm pasting the URL correctly.
Thanks in advance!
2022-09-16 00:12:32,556 [INFO ] Validating CSV & Notion DB schema
2022-09-16 00:12:33,307 [CRITICAL] Provided URL links does not point to a Notion database.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.