question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange addRow behaviour depending on contents of previous rows

See original GitHub issue

I have a 2 sheets of invoices (a and b), and I am using v3.0.11 of node-google-spreadsheet to write to these: await a.addRow(invoice, { insert: true }); and await b.addRow(invoice, { insert: true });

Strangely, everything added to ‘a’ has added properly, but each line in ‘b’ staggers - invoice 1 starts in column A, but then invoice 2 starts in column W, and then invoice 3 a further 22 columns later - column AS (there are 26 object memebers in an invoice - so invoice one occupies columns A-Z)

After much testing, I found that if I delete the pre-existing data in the sheet for all ‘b’ invoices (leaving the header row in row 1) it stops staggering on the writes. When I put it back, it starts staggering again. So somehow the existing data is having an effect on the writing of the row, and staggering it?!?!

I also tested with addRow and addRows, and {insert: true} present and absent, same issue.

If there is any more info I can supply, or testing I can do, please feel free to let me know,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
theoephraimcommented, Aug 17, 2020

Hey guys - so I think I have this solved. Basically the google API looks for the right “table” (continuous grid of data) to insert the data into and when there are gaps, some weird things can happen. By telling the endpoint to look for data starting at cell A1, it seems to operate as expected.

Deploying the fix shortly.

1reaction
UtkarshChandelcommented, Jul 27, 2020

Yes same issue in my case when having blank cells in the sheet, Specially if the headers are blank. The issue gets resolved once I remove all the blank cells…But I do require a few blank cells in my sheets sometimes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Row duplicates Checkboxes from previo… - Apple Community
I have a spreadsheet with several Checkbox columns. If I add a new Row, it creates a blank row, but it duplicates the...
Read more >
Add row to dataframe based on condition of previous row in R
Using tidyverse you can use complete : library(tidyverse) mydata %>% complete(days, class, fill = list(value = 0)). Output
Read more >
exceljs/exceljs: Excel Workbook Manager - GitHub
The reason the WorksheetWriter does not commit rows as they are added is to allow cells to be merged across rows: worksheet.mergeCells('A1:B2'); worksheet ......
Read more >
Auto-placement in grid layout - CSS: Cascading Style Sheets
The default flow is to arrange items by row. Grid will lay an item out into each cell of row 1. If you...
Read more >
Strange behavior caused by the UPPER function when used ...
You get two rows with Market and UPC showing up in the CONTENTS column. Now for the odd part. If you adjust the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found