简体   繁体   中英

Is it possible to Import data in AWS DynamoDB from Excel file?

I have made an excel file with some ~200-300 rows, and I would like to import the data in DynamoDB.

To be clear, I have just created an empty table with just the Primary key & Sort key. So in all, I have only 2 fields in DynamoDB table, but 12 in my Excel file.

I want to import the excel data to the table, so all the 200-300 rows appear in my DynamoDB.
Is it possible to fill an empty DynamoDB table with an excel file?


Any help is appreciated:)
Thanks!

Not directly, you need to use code which will parse xls content and transform it into form DynamoDB accepts as a valid input.

Quick google gives yields some plugins written for Excel, but I cannot speak about their functionality or security.

Other option would be to write lambda function which reads file from S3 and puts data into table.

Yet another option would be to try to create Data Pipeline . If it's something you expect to do over and over, this is probably better. If it's one-time job for one file, lambda would be cheaper (essentially free aside your time)

For this, you can store your excel file to S3 bucket. then create a AWS Lambda function to read your excel file from S3 bucket and create correct response format as your DynamoDB structure.

Yes, you can.. this is the one of samples

  1. Assume there is one unique data from your 12 excel colums, let say the column name "A"
  2. Set the column "A" as your Primary Key data
  3. For the Sort Key data, put the item in timestamp with prefix eg "excel_567xxxx" -> excel is prefix, 567xxxxx is timestamp
  4. Set the other 11 colums for the rest attributes. You can do horizotally or vertically.

Sample of horizontal data:

PrimaryKey | SortKey | col2 | col3 | col4 | etc
"abcdxxx", "excel_564xxx", "bbb", "ccc", "ddd", etc

Sample of vertical data:

PrimaryKey | SortKey | data
"abcdxxx", "excel_564xxx", {"col2":"bbb", "col3":"ccc", "col4":"ddd", etc}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM